Mercurial > vim
diff src/eval.c @ 8178:e77efd7a7dad v7.4.1382
commit https://github.com/vim/vim/commit/02e83b438ea7071fdb176dabbaefea319ab2d686
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 21 20:10:26 2016 +0100
patch 7.4.1382
Problem: Can't get the job of a channel.
Solution: Add ch_getjob().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 21 Feb 2016 20:15:04 +0100 |
parents | f2286ff0c102 |
children | 95d59081580f |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -501,6 +501,9 @@ static void f_ceil(typval_T *argvars, ty #endif #ifdef FEAT_CHANNEL static void f_ch_close(typval_T *argvars, typval_T *rettv); +# ifdef FEAT_JOB +static void f_ch_getjob(typval_T *argvars, typval_T *rettv); +# endif static void f_ch_log(typval_T *argvars, typval_T *rettv); static void f_ch_logfile(typval_T *argvars, typval_T *rettv); static void f_ch_open(typval_T *argvars, typval_T *rettv); @@ -8186,6 +8189,9 @@ static struct fst #endif #ifdef FEAT_CHANNEL {"ch_close", 1, 1, f_ch_close}, +# ifdef FEAT_JOB + {"ch_getjob", 1, 1, f_ch_getjob}, +# endif {"ch_log", 1, 2, f_ch_log}, {"ch_logfile", 1, 2, f_ch_logfile}, {"ch_open", 1, 2, f_ch_open}, @@ -10186,6 +10192,25 @@ f_ch_close(typval_T *argvars, typval_T * channel_close(channel); } +# ifdef FEAT_JOB +/* + * "ch_getjob()" function + */ + static void +f_ch_getjob(typval_T *argvars, typval_T *rettv) +{ + channel_T *channel = get_channel_arg(&argvars[0]); + + if (channel != NULL) + { + rettv->v_type = VAR_JOB; + rettv->vval.v_job = channel->ch_job; + if (channel->ch_job != NULL) + ++channel->ch_job->jv_refcount; + } +} +# endif + /* * "ch_log()" function */