From: Bram Moolenaar Date: Wed, 17 Feb 2016 09:05:42 +0000 (+0100) Subject: patch 7.4.1343 X-Git-Tag: v7.4.1343 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd39bbcd1dd5bdc280f0fa5833b1107853f1227f;p=thirdparty%2Fvim.git 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 index 963d9db672..efabc08ea7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -9850,6 +9850,68 @@ f_ceil(typval_T *argvars, typval_T *rettv) } #endif +#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. + * Return NULL for an invalid argument. + */ + static char_u * +get_callback(typval_T *arg) +{ + if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING) + return arg->vval.v_string; + if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0) + return (char_u *)""; + EMSG(_("E999: Invalid callback argument")); + return NULL; +} + +/* + * Get the option entries from "dict", and parse them. + * If an option value is invalid return FAIL. + */ + static int +get_job_options(dict_T *dict, jobopt_T *opt) +{ + dictitem_T *item; + char_u *mode; + + if (dict == NULL) + return OK; + + if ((item = dict_find(dict, (char_u *)"mode", -1)) != NULL) + { + mode = get_tv_string(&item->di_tv); + if (STRCMP(mode, "nl") == 0) + opt->jo_mode = MODE_NL; + else if (STRCMP(mode, "raw") == 0) + opt->jo_mode = MODE_RAW; + else if (STRCMP(mode, "js") == 0) + opt->jo_mode = MODE_JS; + else if (STRCMP(mode, "json") == 0) + opt->jo_mode = MODE_JSON; + else + { + EMSG2(_(e_invarg2), mode); + return FAIL; + } + } + + if ((item = dict_find(dict, (char_u *)"callback", -1)) != NULL) + { + opt->jo_callback = get_callback(&item->di_tv); + if (opt->jo_callback == NULL) + { + EMSG2(_(e_invarg2), "callback"); + return FAIL; + } + } + + return OK; +} +#endif + #ifdef FEAT_CHANNEL /* * Get the channel from the argument. @@ -9887,22 +9949,6 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) channel_close(channel); } -/* - * Get a callback from "arg". It can be a Funcref or a function name. - * When "arg" is zero return an empty string. - * Return NULL for an invalid argument. - */ - static char_u * -get_callback(typval_T *arg) -{ - if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING) - return arg->vval.v_string; - if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0) - return (char_u *)""; - EMSG(_("E999: Invalid callback argument")); - return NULL; -} - /* * "ch_logfile()" function */ @@ -9929,50 +9975,6 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) ch_logfile(file); } -/* - * Get the option entries from "dict", and parse them. - * If an option value is invalid return FAIL. - */ - static int -get_job_options(dict_T *dict, jobopt_T *opt) -{ - dictitem_T *item; - char_u *mode; - - if (dict == NULL) - return OK; - - if ((item = dict_find(dict, (char_u *)"mode", -1)) != NULL) - { - mode = get_tv_string(&item->di_tv); - if (STRCMP(mode, "nl") == 0) - opt->jo_mode = MODE_NL; - else if (STRCMP(mode, "raw") == 0) - opt->jo_mode = MODE_RAW; - else if (STRCMP(mode, "js") == 0) - opt->jo_mode = MODE_JS; - else if (STRCMP(mode, "json") == 0) - opt->jo_mode = MODE_JSON; - else - { - EMSG2(_(e_invarg2), mode); - return FAIL; - } - } - - if ((item = dict_find(dict, (char_u *)"callback", -1)) != NULL) - { - opt->jo_callback = get_callback(&item->di_tv); - if (opt->jo_callback == NULL) - { - EMSG2(_(e_invarg2), "callback"); - return FAIL; - } - } - - return OK; -} - /* * "ch_open()" function */ diff --git a/src/version.c b/src/version.c index e77457b93d..4f59a610f7 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1343, /**/ 1342, /**/