To: vim_dev@googlegroups.com Subject: Patch 7.4.1343 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1343 Problem: Can't compile with +job but without +channel. (Andrei Olsen) Solution: Move get_job_options up and adjust #ifdef. Files: src/eval.c *** ../vim-7.4.1342/src/eval.c 2016-02-16 22:01:23.822490218 +0100 --- src/eval.c 2016-02-17 10:03:58.272325666 +0100 *************** *** 9850,9855 **** --- 9850,9917 ---- } #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,9909 **** } /* - * 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 --- 9950,9955 ---- *************** *** 9930,9979 **** } /* - * 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 --- 9976,9981 ---- *** ../vim-7.4.1342/src/version.c 2016-02-16 22:01:23.826490176 +0100 --- src/version.c 2016-02-17 10:04:48.647779539 +0100 *************** *** 749,750 **** --- 749,752 ---- { /* Add new patch number below this line */ + /**/ + 1343, /**/ -- Facepalm reply #9: "Speed up, you can drive 80 here" "Why, the cars behind us are also driving 60" /// 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 ///