diff src/channel.c @ 8132:f96536c291d8 v7.4.1360

commit https://github.com/vim/vim/commit/0ba75a9714884895b2ac09733158c47544a8dfb9 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 19 23:21:26 2016 +0100 patch 7.4.1360 Problem: Can't remove a callback with ch_setoptions(). Solution: When passing zero or an empty string remove the callback.
author Christian Brabandt <cb@256bit.org>
date Fri, 19 Feb 2016 23:30:04 +0100
parents 310dd635e8c9
children 8abef552ece7
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -749,16 +749,6 @@ channel_set_job(channel_T *channel, 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, 
     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;
+    }
 }
 
 /*