diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-17 10:05:42 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-17 10:05:42 +0100 |
commit | cd39bbcd1dd5bdc280f0fa5833b1107853f1227f (patch) | |
tree | a42e412199d3922d7d787d2bda2e79852f07d6f2 | |
parent | e74e8e7d758e9312165a931f176185f07a64231a (diff) | |
download | vim-git-cd39bbcd1dd5bdc280f0fa5833b1107853f1227f.tar.gz |
patch 7.4.1343v7.4.1343
Problem: Can't compile with +job but without +channel. (Andrei Olsen)
Solution: Move get_job_options up and adjust #ifdef.
-rw-r--r-- | src/eval.c | 122 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 64 insertions, 60 deletions
diff --git a/src/eval.c b/src/eval.c index 963d9db67..efabc08ea 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. @@ -9888,22 +9950,6 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) } /* - * 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 */ static void @@ -9930,50 +9976,6 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) } /* - * 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 */ static void diff --git a/src/version.c b/src/version.c index e77457b93..4f59a610f 100644 --- 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, |