# HG changeset patch # User Christian Brabandt # Date 1455700505 -3600 # Node ID 7bc924a34288b6c848a2129e7823bacc15fd18bc # Parent ada3c0a25025ab6d0be07e8977f8d7752c86ffc7 commit https://github.com/vim/vim/commit/cd39bbcd1dd5bdc280f0fa5833b1107853f1227f Author: Bram Moolenaar Date: Wed Feb 17 10:05:42 2016 +0100 patch 7.4.1343 Problem: Can't compile with +job but without +channel. (Andrei Olsen) Solution: Move get_job_options up and adjust #ifdef. diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -9850,43 +9850,7 @@ f_ceil(typval_T *argvars, typval_T *rett } #endif -#ifdef FEAT_CHANNEL -/* - * Get the channel from the argument. - * Returns NULL if the handle is invalid. - */ - static channel_T * -get_channel_arg(typval_T *tv) -{ - channel_T *channel; - - if (tv->v_type != VAR_CHANNEL) - { - EMSG2(_(e_invarg2), get_tv_string(tv)); - return NULL; - } - channel = tv->vval.v_channel; - - if (channel == NULL || !channel_is_open(channel)) - { - EMSG(_("E906: not an open channel")); - return NULL; - } - return channel; -} - -/* - * "ch_close()" function - */ - static void -f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) -{ - channel_T *channel = get_channel_arg(&argvars[0]); - - if (channel != NULL) - channel_close(channel); -} - +#if defined(FEAT_CHANNEL) || defined(FEAT_JOB) /* * Get a callback from "arg". It can be a Funcref or a function name. * When "arg" is zero return an empty string. @@ -9904,32 +9868,6 @@ get_callback(typval_T *arg) } /* - * "ch_logfile()" function - */ - static void -f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) -{ - char_u *fname; - char_u *opt = (char_u *)""; - char_u buf[NUMBUFLEN]; - FILE *file = NULL; - - fname = get_tv_string(&argvars[0]); - if (argvars[1].v_type == VAR_STRING) - opt = get_tv_string_buf(&argvars[1], buf); - if (*fname != NUL) - { - file = fopen((char *)fname, *opt == 'w' ? "w" : "a"); - if (file == NULL) - { - EMSG2(_(e_notopen), fname); - return; - } - } - ch_logfile(file); -} - -/* * Get the option entries from "dict", and parse them. * If an option value is invalid return FAIL. */ @@ -9972,6 +9910,70 @@ get_job_options(dict_T *dict, jobopt_T * return OK; } +#endif + +#ifdef FEAT_CHANNEL +/* + * Get the channel from the argument. + * Returns NULL if the handle is invalid. + */ + static channel_T * +get_channel_arg(typval_T *tv) +{ + channel_T *channel; + + if (tv->v_type != VAR_CHANNEL) + { + EMSG2(_(e_invarg2), get_tv_string(tv)); + return NULL; + } + channel = tv->vval.v_channel; + + if (channel == NULL || !channel_is_open(channel)) + { + EMSG(_("E906: not an open channel")); + return NULL; + } + return channel; +} + +/* + * "ch_close()" function + */ + static void +f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) +{ + channel_T *channel = get_channel_arg(&argvars[0]); + + if (channel != NULL) + channel_close(channel); +} + +/* + * "ch_logfile()" function + */ + static void +f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) +{ + char_u *fname; + char_u *opt = (char_u *)""; + char_u buf[NUMBUFLEN]; + FILE *file = NULL; + + fname = get_tv_string(&argvars[0]); + if (argvars[1].v_type == VAR_STRING) + opt = get_tv_string_buf(&argvars[1], buf); + if (*fname != NUL) + { + file = fopen((char *)fname, *opt == 'w' ? "w" : "a"); + if (file == NULL) + { + EMSG2(_(e_notopen), fname); + return; + } + } + ch_logfile(file); +} /* * "ch_open()" function diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 1343, +/**/ 1342, /**/ 1341,