]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1360 v7.4.1360
authorBram Moolenaar <Bram@vim.org>
Fri, 19 Feb 2016 22:21:26 +0000 (23:21 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 19 Feb 2016 22:21:26 +0000 (23:21 +0100)
Problem:    Can't remove a callback with ch_setoptions().
Solution:   When passing zero or an empty string remove the callback.

src/channel.c
src/proto/channel.pro
src/testdir/test_channel.vim
src/version.c

index cd0c584739e682b91df07b2908891b9c2d663220..967e2da0b9bd5f7a3484e017b1dbe2b3ccfad0c1 100644 (file)
@@ -748,16 +748,6 @@ channel_set_job(channel_T *channel, job_T *job)
     channel->ch_job = job;
 }
 
-/*
- * Set the callback for channel "channel".
- */
-    void
-channel_set_callback(channel_T *channel, char_u *callback)
-{
-    vim_free(channel->ch_callback);
-    channel->ch_callback = vim_strsave(callback);
-}
-
 /*
  * Set various properties from an "options" argument.
  */
@@ -769,9 +759,14 @@ channel_set_options(channel_T *channel, jobopt_T *options)
     if (options->jo_set & JO_TIMEOUT)
        channel->ch_timeout = options->jo_timeout;
 
-    if ((options->jo_set & JO_CALLBACK)
-           && options->jo_callback != NULL && *options->jo_callback != NUL)
-       channel_set_callback(channel, options->jo_callback);
+    if (options->jo_set & JO_CALLBACK)
+    {
+       vim_free(channel->ch_callback);
+       if (options->jo_callback != NULL && *options->jo_callback != NUL)
+           channel->ch_callback = vim_strsave(options->jo_callback);
+       else
+           channel->ch_callback = NULL;
+    }
 }
 
 /*
index 89504b594ece57e2b3737fcfa211b0b2be463832..553fb54280550262339e6060d87874121d133431 100644 (file)
@@ -10,7 +10,6 @@ void channel_gui_register_all(void);
 channel_T *channel_open(char *hostname, int port_in, int waittime, void (*close_cb)(void));
 void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err);
 void channel_set_job(channel_T *channel, job_T *job);
-void channel_set_callback(channel_T *channel, char_u *callback);
 void channel_set_options(channel_T *channel, jobopt_T *options);
 void channel_set_req_callback(channel_T *channel, char_u *callback, int id);
 char_u *channel_get(channel_T *channel);
index 431e40727c4ef9110c6329f3ad97d22daeb0f660..2ed3abffacef476976237bf379a34baa2a403e18 100644 (file)
@@ -149,6 +149,7 @@ func s:communicate(port)
   call ch_setoptions(handle, {'timeout': 1111})
   call assert_fails("call ch_setoptions(handle, {'waittime': 111})", "E475")
   call assert_fails("call ch_setoptions(handle, {'mode': 'json'})", "E475")
+  call ch_setoptions(handle, {'callback': ''})
 
   " Send an eval request that works.
   call assert_equal('ok', ch_sendexpr(handle, 'eval-works'))
index 4af3f65a702424bbc0ddabe0f9fd5c1395ff94af..916c52c2f9f9995797bae4d2c89cf575e3055ced 100644 (file)
@@ -747,6 +747,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1360,
 /**/
     1359,
 /**/