To: vim_dev@googlegroups.com Subject: Patch 7.4.1360 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1360 Problem: Can't remove a callback with ch_setoptions(). Solution: When passing zero or an empty string remove the callback. Files: src/channel.c, src/proto/channel.pro, src/testdir/test_channel.vim *** ../vim-7.4.1359/src/channel.c 2016-02-19 22:33:31.492263407 +0100 --- src/channel.c 2016-02-19 23:18:06.004116634 +0100 *************** *** 749,764 **** } /* - * 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 --- 748,753 ---- *************** *** 769,777 **** 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); } /* --- 758,771 ---- if (options->jo_set & JO_TIMEOUT) channel->ch_timeout = options->jo_timeout; ! 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; ! } } /* *** ../vim-7.4.1359/src/proto/channel.pro 2016-02-19 22:33:31.500263323 +0100 --- src/proto/channel.pro 2016-02-19 23:20:26.586639147 +0100 *************** *** 10,16 **** 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); --- 10,15 ---- *** ../vim-7.4.1359/src/testdir/test_channel.vim 2016-02-19 22:59:39.839745582 +0100 --- src/testdir/test_channel.vim 2016-02-19 23:15:02.974040123 +0100 *************** *** 149,154 **** --- 149,155 ---- 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')) *** ../vim-7.4.1359/src/version.c 2016-02-19 22:59:39.843745540 +0100 --- src/version.c 2016-02-19 23:19:03.011517509 +0100 *************** *** 749,750 **** --- 749,752 ---- { /* Add new patch number below this line */ + /**/ + 1360, /**/ -- Not too long ago, compress was something you did to garbage... /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///