summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-19 23:21:26 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-19 23:21:26 +0100
commit0ba75a9714884895b2ac09733158c47544a8dfb9 (patch)
treeccfd64eec29d21820021d1e8dda5f1a7a746c330
parent1f6ef66254c1e25ef1c7972aa9a0ba119ebc17e4 (diff)
downloadvim-git-0ba75a9714884895b2ac09733158c47544a8dfb9.tar.gz
patch 7.4.1360v7.4.1360
Problem: Can't remove a callback with ch_setoptions(). Solution: When passing zero or an empty string remove the callback.
-rw-r--r--src/channel.c21
-rw-r--r--src/proto/channel.pro1
-rw-r--r--src/testdir/test_channel.vim1
-rw-r--r--src/version.c2
4 files changed, 11 insertions, 14 deletions
diff --git a/src/channel.c b/src/channel.c
index cd0c58473..967e2da0b 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -749,16 +749,6 @@ channel_set_job(channel_T *channel, job_T *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.
*/
void
@@ -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;
+ }
}
/*
diff --git a/src/proto/channel.pro b/src/proto/channel.pro
index 89504b594..553fb5428 100644
--- a/src/proto/channel.pro
+++ b/src/proto/channel.pro
@@ -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);
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index 431e40727..2ed3abffa 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -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'))
diff --git a/src/version.c b/src/version.c
index 4af3f65a7..916c52c2f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -748,6 +748,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1360,
+/**/
1359,
/**/
1358,