0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 7.4.1360

Problem:    Can't remove a callback with ch_setoptions().
Solution:   When passing zero or an empty string remove the callback.
This commit is contained in:
Bram Moolenaar
2016-02-19 23:21:26 +01:00
parent 1f6ef66254
commit 0ba75a9714
4 changed files with 11 additions and 14 deletions

View 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;
}
}
/*