diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-12-21 16:04:21 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-12-21 16:04:21 +0100 |
commit | d155d7a8519987361169459b8d464ae1caef5e9c (patch) | |
tree | 26d437fd67b33ca1b57aca568d4da40151bc9a81 | |
parent | 162b71479bd4dcdb3a2ef9198a1444f6f99e6843 (diff) | |
download | vim-git-d155d7a8519987361169459b8d464ae1caef5e9c.tar.gz |
patch 8.1.0615: get_tv function names are not consistentv8.1.0615
Problem: Get_tv function names are not consistent.
Solution: Rename to tv_get.
-rw-r--r-- | src/channel.c | 80 | ||||
-rw-r--r-- | src/dict.c | 8 | ||||
-rw-r--r-- | src/edit.c | 2 | ||||
-rw-r--r-- | src/eval.c | 214 | ||||
-rw-r--r-- | src/evalfunc.c | 822 | ||||
-rw-r--r-- | src/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/json.c | 2 | ||||
-rw-r--r-- | src/list.c | 6 | ||||
-rw-r--r-- | src/message.c | 6 | ||||
-rw-r--r-- | src/misc2.c | 2 | ||||
-rw-r--r-- | src/os_unix.c | 12 | ||||
-rw-r--r-- | src/os_win32.c | 2 | ||||
-rw-r--r-- | src/popupmnu.c | 2 | ||||
-rw-r--r-- | src/proto/eval.pro | 14 | ||||
-rw-r--r-- | src/regexp.c | 2 | ||||
-rw-r--r-- | src/tag.c | 2 | ||||
-rw-r--r-- | src/terminal.c | 44 | ||||
-rw-r--r-- | src/textprop.c | 26 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 20 |
20 files changed, 637 insertions, 633 deletions
diff --git a/src/channel.c b/src/channel.c index 11ecc1685..cb435c8bc 100644 --- a/src/channel.c +++ b/src/channel.c @@ -938,7 +938,7 @@ channel_open_func(typval_T *argvars) jobopt_T opt; channel_T *channel = NULL; - address = get_tv_string(&argvars[0]); + address = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN && (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)) { @@ -4003,7 +4003,7 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - text = get_tv_string_buf(&argvars[1], buf); + text = tv_get_string_buf(&argvars[1], buf); channel = send_common(argvars, text, 0, eval, &opt, eval ? "ch_evalraw" : "ch_sendraw", &part_read); if (channel != NULL && eval) @@ -4402,7 +4402,7 @@ channel_get_timeout(channel_T *channel, ch_part_T part) static int handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo) { - char_u *val = get_tv_string(item); + char_u *val = tv_get_string(item); opt->jo_set |= jo; if (STRCMP(val, "nl") == 0) @@ -4424,7 +4424,7 @@ handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo) static int handle_io(typval_T *item, ch_part_T part, jobopt_T *opt) { - char_u *val = get_tv_string(item); + char_u *val = tv_get_string(item); opt->jo_set |= JO_OUT_IO << (part - PART_OUT); if (STRCMP(val, "null") == 0) @@ -4561,7 +4561,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported & JO_MODE)) break; - opt->jo_noblock = get_tv_number(item); + opt->jo_noblock = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_io") == 0 || STRCMP(hi->hi_key, "out_io") == 0 @@ -4582,13 +4582,13 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) break; opt->jo_set |= JO_OUT_NAME << (part - PART_OUT); opt->jo_io_name[part] = - get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]); + tv_get_string_buf_chk(item, opt->jo_io_name_buf[part]); } else if (STRCMP(hi->hi_key, "pty") == 0) { if (!(supported & JO_MODE)) break; - opt->jo_pty = get_tv_number(item); + opt->jo_pty = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_buf") == 0 || STRCMP(hi->hi_key, "out_buf") == 0 @@ -4599,10 +4599,10 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set |= JO_OUT_BUF << (part - PART_OUT); - opt->jo_io_buf[part] = get_tv_number(item); + opt->jo_io_buf[part] = tv_get_number(item); if (opt->jo_io_buf[part] <= 0) { - EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } if (buflist_findnr(opt->jo_io_buf[part]) == NULL) @@ -4619,7 +4619,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set |= JO_OUT_MODIFIABLE << (part - PART_OUT); - opt->jo_modifiable[part] = get_tv_number(item); + opt->jo_modifiable[part] = tv_get_number(item); } else if (STRCMP(hi->hi_key, "out_msg") == 0 || STRCMP(hi->hi_key, "err_msg") == 0) @@ -4629,7 +4629,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set2 |= JO2_OUT_MSG << (part - PART_OUT); - opt->jo_message[part] = get_tv_number(item); + opt->jo_message[part] = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_top") == 0 || STRCMP(hi->hi_key, "in_bot") == 0) @@ -4648,10 +4648,10 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) lp = &opt->jo_in_bot; opt->jo_set |= JO_IN_BOT; } - *lp = get_tv_number(item); + *lp = tv_get_number(item); if (*lp < 0) { - EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } } @@ -4718,7 +4718,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) else if (STRCMP(hi->hi_key, "drop") == 0) { int never = FALSE; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "never") == 0) never = TRUE; @@ -4747,7 +4747,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_NAME)) break; opt->jo_set2 |= JO2_TERM_NAME; - opt->jo_term_name = get_tv_string_chk(item); + opt->jo_term_name = tv_get_string_chk(item); if (opt->jo_term_name == NULL) { EMSG2(_(e_invargval), "term_name"); @@ -4758,7 +4758,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported2 & JO2_TERM_FINISH)) break; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) { EMSG3(_(e_invargNval), "term_finish", val); @@ -4774,7 +4774,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_OPENCMD)) break; opt->jo_set2 |= JO2_TERM_OPENCMD; - p = opt->jo_term_opencmd = get_tv_string_chk(item); + p = opt->jo_term_opencmd = tv_get_string_chk(item); if (p != NULL) { /* Must have %d and no other %. */ @@ -4796,7 +4796,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_EOF_CHARS)) break; opt->jo_set2 |= JO2_EOF_CHARS; - p = opt->jo_eof_chars = get_tv_string_chk(item); + p = opt->jo_eof_chars = tv_get_string_chk(item); if (p == NULL) { EMSG2(_(e_invargval), "eof_chars"); @@ -4808,54 +4808,54 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_ROWS)) break; opt->jo_set2 |= JO2_TERM_ROWS; - opt->jo_term_rows = get_tv_number(item); + opt->jo_term_rows = tv_get_number(item); } else if (STRCMP(hi->hi_key, "term_cols") == 0) { if (!(supported2 & JO2_TERM_COLS)) break; opt->jo_set2 |= JO2_TERM_COLS; - opt->jo_term_cols = get_tv_number(item); + opt->jo_term_cols = tv_get_number(item); } else if (STRCMP(hi->hi_key, "vertical") == 0) { if (!(supported2 & JO2_VERTICAL)) break; opt->jo_set2 |= JO2_VERTICAL; - opt->jo_vertical = get_tv_number(item); + opt->jo_vertical = tv_get_number(item); } else if (STRCMP(hi->hi_key, "curwin") == 0) { if (!(supported2 & JO2_CURWIN)) break; opt->jo_set2 |= JO2_CURWIN; - opt->jo_curwin = get_tv_number(item); + opt->jo_curwin = tv_get_number(item); } else if (STRCMP(hi->hi_key, "hidden") == 0) { if (!(supported2 & JO2_HIDDEN)) break; opt->jo_set2 |= JO2_HIDDEN; - opt->jo_hidden = get_tv_number(item); + opt->jo_hidden = tv_get_number(item); } else if (STRCMP(hi->hi_key, "norestore") == 0) { if (!(supported2 & JO2_NORESTORE)) break; opt->jo_set2 |= JO2_NORESTORE; - opt->jo_term_norestore = get_tv_number(item); + opt->jo_term_norestore = tv_get_number(item); } else if (STRCMP(hi->hi_key, "term_kill") == 0) { if (!(supported2 & JO2_TERM_KILL)) break; opt->jo_set2 |= JO2_TERM_KILL; - opt->jo_term_kill = get_tv_string_chk(item); + opt->jo_term_kill = tv_get_string_chk(item); } # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) else if (STRCMP(hi->hi_key, "ansi_colors") == 0) { - int n = 0; + int n = 0; listitem_T *li; long_u rgb[16]; @@ -4873,9 +4873,9 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) for (; li != NULL && n < 16; li = li->li_next, n++) { char_u *color_name; - guicolor_T guicolor; + guicolor_T guicolor; - color_name = get_tv_string_chk(&li->li_tv); + color_name = tv_get_string_chk(&li->li_tv); if (color_name == NULL) return FAIL; @@ -4915,7 +4915,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported2 & JO2_CWD)) break; - opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); + opt->jo_cwd = tv_get_string_buf_chk(item, opt->jo_cwd_buf); if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd) #ifndef WIN32 // Win32 directories don't have the concept of "executable" || mch_access((char *)opt->jo_cwd, X_OK) != 0 @@ -4932,35 +4932,35 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_WAITTIME)) break; opt->jo_set |= JO_WAITTIME; - opt->jo_waittime = get_tv_number(item); + opt->jo_waittime = tv_get_number(item); } else if (STRCMP(hi->hi_key, "timeout") == 0) { if (!(supported & JO_TIMEOUT)) break; opt->jo_set |= JO_TIMEOUT; - opt->jo_timeout = get_tv_number(item); + opt->jo_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "out_timeout") == 0) { if (!(supported & JO_OUT_TIMEOUT)) break; opt->jo_set |= JO_OUT_TIMEOUT; - opt->jo_out_timeout = get_tv_number(item); + opt->jo_out_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "err_timeout") == 0) { if (!(supported & JO_ERR_TIMEOUT)) break; opt->jo_set |= JO_ERR_TIMEOUT; - opt->jo_err_timeout = get_tv_number(item); + opt->jo_err_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "part") == 0) { if (!(supported & JO_PART)) break; opt->jo_set |= JO_PART; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "err") == 0) opt->jo_part = PART_ERR; else if (STRCMP(val, "out") == 0) @@ -4976,14 +4976,14 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_ID)) break; opt->jo_set |= JO_ID; - opt->jo_id = get_tv_number(item); + opt->jo_id = tv_get_number(item); } else if (STRCMP(hi->hi_key, "stoponexit") == 0) { if (!(supported & JO_STOPONEXIT)) break; opt->jo_set |= JO_STOPONEXIT; - opt->jo_stoponexit = get_tv_string_buf_chk(item, + opt->jo_stoponexit = tv_get_string_buf_chk(item, opt->jo_soe_buf); if (opt->jo_stoponexit == NULL) { @@ -4996,7 +4996,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_BLOCK_WRITE)) break; opt->jo_set |= JO_BLOCK_WRITE; - opt->jo_block_write = get_tv_number(item); + opt->jo_block_write = tv_get_number(item); } else break; @@ -5035,7 +5035,7 @@ get_channel_arg(typval_T *tv, int check_open, int reading, ch_part_T part) } else { - EMSG2(_(e_invarg2), get_tv_string(tv)); + EMSG2(_(e_invarg2), tv_get_string(tv)); return NULL; } if (channel != NULL && reading) @@ -5262,7 +5262,7 @@ win32_build_cmd(list_T *l, garray_T *gap) for (li = l->lv_first; li != NULL; li = li->li_next) { - s = get_tv_string_chk(&li->li_tv); + s = tv_get_string_chk(&li->li_tv); if (s == NULL) return FAIL; s = win32_escape_arg(s); @@ -5832,7 +5832,7 @@ job_stop(job_T *job, typval_T *argvars, char *type) arg = (char_u *)""; else { - arg = get_tv_string_chk(&argvars[1]); + arg = tv_get_string_chk(&argvars[1]); if (arg == NULL) { EMSG(_(e_invarg)); diff --git a/src/dict.c b/src/dict.c index 9ba0231f2..34ba3e0e4 100644 --- a/src/dict.c +++ b/src/dict.c @@ -495,7 +495,7 @@ dict_get_string(dict_T *d, char_u *key, int save) di = dict_find(d, key, -1); if (di == NULL) return NULL; - s = get_tv_string(&di->di_tv); + s = tv_get_string(&di->di_tv); if (save && s != NULL) s = vim_strsave(s); return s; @@ -513,7 +513,7 @@ dict_get_number(dict_T *d, char_u *key) di = dict_find(d, key, -1); if (di == NULL) return 0; - return get_tv_number(&di->di_tv); + return tv_get_number(&di->di_tv); } /* @@ -630,10 +630,10 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate) } if (evaluate) { - key = get_tv_string_buf_chk(&tvkey, buf); + key = tv_get_string_buf_chk(&tvkey, buf); if (key == NULL) { - /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ + /* "key" is NULL when tv_get_string_buf_chk() gave an errmsg */ clear_tv(&tvkey); goto failret; } diff --git a/src/edit.c b/src/edit.c index c23597691..c6b061968 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4363,7 +4363,7 @@ ins_compl_add_tv(typval_T *tv, int dir) } else { - word = get_tv_string_chk(tv); + word = tv_get_string_chk(tv); vim_memset(cptext, 0, sizeof(cptext)); } if (word == NULL || (!aempty && *word == NUL)) diff --git a/src/eval.c b/src/eval.c index 18aa5e562..1d14e1b0e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -681,7 +681,7 @@ eval_to_bool( *error = FALSE; if (!skip) { - retval = (get_tv_number_chk(&tv, error) != 0); + retval = (tv_get_number_chk(&tv, error) != 0); clear_tv(&tv); } } @@ -720,7 +720,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) } else { - s = get_tv_string_buf_chk(expr, buf); + s = tv_get_string_buf_chk(expr, buf); if (s == NULL) return FAIL; s = skipwhite(s); @@ -751,7 +751,7 @@ eval_expr_to_bool(typval_T *expr, int *error) *error = TRUE; return FALSE; } - res = (get_tv_number_chk(&rettv, error) != 0); + res = (tv_get_number_chk(&rettv, error) != 0); clear_tv(&rettv); return res; } @@ -776,7 +776,7 @@ eval_to_string_skip( retval = NULL; else { - retval = vim_strsave(get_tv_string(&tv)); + retval = vim_strsave(tv_get_string(&tv)); clear_tv(&tv); } if (skip) @@ -841,7 +841,7 @@ eval_to_string( } #endif else - retval = vim_strsave(get_tv_string(&tv)); + retval = vim_strsave(tv_get_string(&tv)); clear_tv(&tv); } @@ -891,7 +891,7 @@ eval_to_number(char_u *expr) retval = -1; else { - retval = get_tv_number_chk(&rettv, NULL); + retval = tv_get_number_chk(&rettv, NULL); clear_tv(&rettv); } --emsg_off; @@ -982,12 +982,12 @@ get_spellword(list_T *list, char_u **pp) li = list->lv_first; if (li == NULL) return -1; - *pp = get_tv_string(&li->li_tv); + *pp = tv_get_string(&li->li_tv); li = li->li_next; if (li == NULL) return -1; - return (int)get_tv_number(&li->li_tv); + return (int)tv_get_number(&li->li_tv); } #endif @@ -1053,7 +1053,7 @@ call_func_retnr( if (call_vim_function(func, argc, argv, &rettv) == FAIL) return -1; - retval = get_tv_number_chk(&rettv, NULL); + retval = tv_get_number_chk(&rettv, NULL); clear_tv(&rettv); return retval; } @@ -1080,7 +1080,7 @@ call_func_retstr( if (call_vim_function(func, argc, argv, &rettv) == FAIL) return NULL; - retval = vim_strsave(get_tv_string(&rettv)); + retval = vim_strsave(tv_get_string(&rettv)); clear_tv(&rettv); return retval; } @@ -1654,7 +1654,7 @@ ex_let_one( { c1 = name[len]; name[len] = NUL; - p = get_tv_string_chk(tv); + p = tv_get_string_chk(tv); if (p != NULL && op != NULL && *op == '.') { int mustfree = FALSE; @@ -1708,8 +1708,8 @@ ex_let_one( c1 = *p; *p = NUL; - n = (long)get_tv_number(tv); - s = get_tv_string_chk(tv); /* != NULL if number or string */ + n = (long)tv_get_number(tv); + s = tv_get_string_chk(tv); /* != NULL if number or string */ if (s != NULL && op != NULL && *op != '=') { opt_type = get_option_value(arg, &numval, @@ -1763,7 +1763,7 @@ ex_let_one( char_u *ptofree = NULL; char_u *s; - p = get_tv_string_chk(tv); + p = tv_get_string_chk(tv); if (p != NULL && op != NULL && *op == '.') { s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC); @@ -1956,7 +1956,7 @@ get_lval( empty1 = FALSE; if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */ return NULL; - if (get_tv_string_chk(&var1) == NULL) + if (tv_get_string_chk(&var1) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -1993,7 +1993,7 @@ get_lval( clear_tv(&var1); return NULL; } - if (get_tv_string_chk(&var2) == NULL) + if (tv_get_string_chk(&var2) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -2024,7 +2024,7 @@ get_lval( if (len == -1) { /* "[key]": get key from "var1" */ - key = get_tv_string_chk(&var1); /* is number or string */ + key = tv_get_string_chk(&var1); /* is number or string */ if (key == NULL) { clear_tv(&var1); @@ -2106,7 +2106,7 @@ get_lval( lp->ll_n1 = 0; else /* is number or string */ - lp->ll_n1 = (long)get_tv_number(&var1); + lp->ll_n1 = (long)tv_get_number(&var1); clear_tv(&var1); lp->ll_dict = NULL; @@ -2136,7 +2136,7 @@ get_lval( */ if (lp->ll_range && !lp->ll_empty2) { - lp->ll_n2 = (long)get_tv_number(&var2); + lp->ll_n2 = (long)tv_get_number(&var2); /* is number or string */ clear_tv(&var2); if (lp->ll_n2 < 0) @@ -2367,7 +2367,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) if (*op == '+' || *op == '-') { /* nr += nr or nr -= nr*/ - n = get_tv_number(tv1); + n = tv_get_number(tv1); #ifdef FEAT_FLOAT if (tv2->v_type == VAR_FLOAT) { @@ -2385,9 +2385,9 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) #endif { if (*op == '+') - n += get_tv_number(tv2); + n += tv_get_number(tv2); else - n -= get_tv_number(tv2); + n -= tv_get_number(tv2); clear_tv(tv1); tv1->v_type = VAR_NUMBER; tv1->vval.v_number = n; @@ -2399,8 +2399,8 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) break; /* str .= str */ - s = get_tv_string(tv1); - s = concat_str(s, get_tv_string_buf(tv2, numbuf)); + s = tv_get_string(tv1); + s = concat_str(s, tv_get_string_buf(tv2, numbuf)); clear_tv(tv1); tv1->v_type = VAR_STRING; tv1->vval.v_string = s; @@ -2419,7 +2419,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) if (tv2->v_type == VAR_FLOAT) f = tv2->vval.v_float; else - f = get_tv_number(tv2); + f = tv_get_number(tv2); if (*op == '+') tv1->vval.v_float += f; else @@ -3271,7 +3271,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate) { int error = FALSE; - if (get_tv_number_chk(rettv, &error) != 0) + if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; clear_tv(rettv); if (error) @@ -3345,7 +3345,7 @@ eval2(char_u **arg, typval_T *rettv, int evaluate) { if (evaluate && first) { - if (get_tv_number_chk(rettv, &error) != 0) + if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; clear_tv(rettv); if (error) @@ -3365,7 +3365,7 @@ eval2(char_u **arg, typval_T *rettv, int evaluate) */ if (evaluate && !result) { - if (get_tv_number_chk(&var2, &error) != 0) + if (tv_get_number_chk(&var2, &error) != 0) result = TRUE; clear_tv(&var2); if (error) @@ -3413,7 +3413,7 @@ eval3(char_u **arg, typval_T *rettv, int evaluate) { if (evaluate && first) { - if (get_tv_number_chk(rettv, &error) == 0) + if (tv_get_number_chk(rettv, &error) == 0) result = FALSE; clear_tv(rettv); if (error) @@ -3433,7 +3433,7 @@ eval3(char_u **arg, typval_T *rettv, int evaluate) */ if (evaluate && result) { - if (get_tv_number_chk(&var2, &error) == 0) + if (tv_get_number_chk(&var2, &error) == 0) result = FALSE; clear_tv(&var2); if (error) @@ -3622,7 +3622,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) * we know that the first operand needs to be a string or number * without evaluating the 2nd operand. So check before to avoid * side effects after an error. */ - if (evaluate && get_tv_string_chk(rettv) == NULL) + if (evaluate && tv_get_string_chk(rettv) == NULL) { clear_tv(rettv); return FAIL; @@ -3646,8 +3646,8 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) */ if (op == '.') { - s1 = get_tv_string_buf(rettv, buf1); /* already checked */ - s2 = get_tv_string_buf_chk(&var2, buf2); + s1 = tv_get_string_buf(rettv, buf1); /* already checked */ + s2 = tv_get_string_buf_chk(&var2, buf2); if (s2 == NULL) /* type error ? */ { clear_tv(rettv); @@ -3686,7 +3686,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) else #endif { - n1 = get_tv_number_chk(rettv, &error); + n1 = tv_get_number_chk(rettv, &error); if (error) { /* This can only happen for "list + non-list". For @@ -3709,7 +3709,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) else #endif { - n2 = get_tv_number_chk(&var2, &error); + n2 = tv_get_number_chk(&var2, &error); if (error) { clear_tv(rettv); @@ -3804,7 +3804,7 @@ eval6( } else #endif - n1 = get_tv_number_chk(rettv, &error); + n1 = tv_get_number_chk(rettv, &error); clear_tv(rettv); if (error) return FAIL; @@ -3835,7 +3835,7 @@ eval6( else #endif { - n2 = get_tv_number_chk(&var2, &error); + n2 = tv_get_number_chk(&var2, &error); clear_tv(&var2); if (error) return FAIL; @@ -4200,7 +4200,7 @@ eval7( f = rettv->vval.v_float; else #endif - val = get_tv_number_chk(rettv, &error); + val = tv_get_number_chk(rettv, &error); if (error) { clear_tv(rettv); @@ -4326,7 +4326,7 @@ eval_index( empty1 = TRUE; else if (eval1(arg, &var1, evaluate) == FAIL) /* recursive! */ return FAIL; - else if (evaluate && get_tv_string_chk(&var1) == NULL) + else if (evaluate && tv_get_string_chk(&var1) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -4348,7 +4348,7 @@ eval_index( clear_tv(&var1); return FAIL; } - else if (evaluate && get_tv_string_chk(&var2) == NULL) + else if (evaluate && tv_get_string_chk(&var2) == NULL) { /* not a number or string */ if (!empty1) @@ -4376,7 +4376,7 @@ eval_index( n1 = 0; if (!empty1 && rettv->v_type != VAR_DICT) { - n1 = get_tv_number(&var1); + n1 = tv_get_number(&var1); clear_tv(&var1); } if (range) @@ -4385,7 +4385,7 @@ eval_index( n2 = -1; else { - n2 = get_tv_number(&var2); + n2 = tv_get_number(&var2); clear_tv(&var2); } } @@ -4403,7 +4403,7 @@ eval_index( case VAR_NUMBER: case VAR_STRING: - s = get_tv_string(rettv); + s = tv_get_string(rettv); len = (long)STRLEN(s); if (range) { @@ -4504,7 +4504,7 @@ eval_index( if (len == -1) { - key = get_tv_string_chk(&var1); + key = tv_get_string_chk(&var1); if (key == NULL) { clear_tv(&var1); @@ -4974,8 +4974,8 @@ tv_equal( return tv1->vval.v_number == tv2->vval.v_number; case VAR_STRING: - s1 = get_tv_string_buf(tv1, buf1); - s2 = get_tv_string_buf(tv2, buf2); + s1 = tv_get_string_buf(tv1, buf1); + s2 = tv_get_string_buf(tv2, buf2); return ((ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2)) == 0); case VAR_SPECIAL: @@ -5652,13 +5652,13 @@ echo_string_core( case VAR_NUMBER: case VAR_UNKNOWN: *tofree = NULL; - r = get_tv_string_buf(tv, numbuf); + r = tv_get_string_buf(tv, numbuf); break; case VAR_JOB: case VAR_CHANNEL: *tofree = NULL; - r = get_tv_string_buf(tv, numbuf); + r = tv_get_string_buf(tv, numbuf); if (composite_val) { *tofree = string_quote(r, FALSE); @@ -5913,7 +5913,7 @@ var2fpos( return &pos; } - name = get_tv_string_chk(varp); + name = tv_get_string_chk(varp); if (name == NULL) return NULL; if (name[0] == '.') /* cursor */ @@ -6363,7 +6363,7 @@ get_vim_var_nr(int idx) char_u * get_vim_var_str(int idx) { - return get_tv_string(&vimvars[idx].vv_tv); + return tv_get_string(&vimvars[idx].vv_tv); } /* @@ -6936,20 +6936,20 @@ init_tv(typval_T *varp) * Get the number value of a variable. * If it is a String variable, uses vim_str2nr(). * For incompatible types, return 0. - * get_tv_number_chk() is similar to get_tv_number(), but informs the + * tv_get_number_chk() is similar to tv_get_number(), but informs the * caller of incompatible types: it sets *denote to TRUE if "denote" * is not NULL or returns -1 otherwise. */ varnumber_T -get_tv_number(typval_T *varp) +tv_get_number(typval_T *varp) { int error = FALSE; - return get_tv_number_chk(varp, &error); /* return 0L on error */ + return tv_get_number_chk(varp, &error); /* return 0L on error */ } varnumber_T -get_tv_number_chk(typval_T *varp, int *denote) +tv_get_number_chk(typval_T *varp, int *denote) { varnumber_T n = 0L; @@ -6991,7 +6991,7 @@ get_tv_number_chk(typval_T *varp, int *denote) break; #endif case VAR_UNKNOWN: - internal_error("get_tv_number(UNKNOWN)"); + internal_error("tv_get_number(UNKNOWN)"); break; } if (denote == NULL) /* useful for values that must be unsigned */ @@ -7003,7 +7003,7 @@ get_tv_number_chk(typval_T *varp, int *denote) #ifdef FEAT_FLOAT float_T -get_tv_float(typval_T *varp) +tv_get_float(typval_T *varp) { switch (varp->v_type) { @@ -7038,7 +7038,7 @@ get_tv_float(typval_T *varp) break; # endif case VAR_UNKNOWN: - internal_error("get_tv_float(UNKNOWN)"); + internal_error("tv_get_float(UNKNOWN)"); break; } return 0; @@ -7048,25 +7048,25 @@ get_tv_float(typval_T *varp) /* * Get the string value of a variable. * If it is a Number variable, the number is converted into a string. - * get_tv_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! - * get_tv_string_buf() uses a given buffer. + * tv_get_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! + * tv_get_string_buf() uses a given buffer. * If the String variable has never been set, return an empty string. * Never returns NULL; - * get_tv_string_chk() and get_tv_string_buf_chk() are similar, but return + * tv_get_string_chk() and tv_get_string_buf_chk() are similar, but return * NULL on error. */ char_u * -get_tv_string(typval_T *varp) +tv_get_string(typval_T *varp) { static char_u mybuf[NUMBUFLEN]; - return get_tv_string_buf(varp, mybuf); + return tv_get_string_buf(varp, mybuf); } char_u * -get_tv_string_buf(typval_T *varp, char_u *buf) +tv_get_string_buf(typval_T *varp, char_u *buf) { - char_u *res = get_tv_string_buf_chk(varp, buf); + char_u *res = tv_get_string_buf_chk(varp, buf); return res != NULL ? res : (char_u *)""; } @@ -7075,15 +7075,15 @@ get_tv_string_buf(typval_T *varp, char_u *buf) * Careful: This uses a single, static buffer. YOU CAN ONLY USE IT ONCE! */ char_u * -get_tv_string_chk(typval_T *varp) +tv_get_string_chk(typval_T *varp) { static char_u mybuf[NUMBUFLEN]; - return get_tv_string_buf_chk(varp, mybuf); + return tv_get_string_buf_chk(varp, mybuf); } char_u * -get_tv_string_buf_chk(typval_T *varp, char_u *buf) +tv_get_string_buf_chk(typval_T *varp, char_u *buf) { switch (varp->v_type) { @@ -7298,7 +7298,7 @@ find_var_ht(char_u *name, char_u **varname) /* * Get the string value of a (global/local) variable. - * Note: see get_tv_string() for how long the pointer remains valid. + * Note: see tv_get_string() for how long the pointer remains valid. * Returns NULL when it doesn't exist. */ char_u * @@ -7309,7 +7309,7 @@ get_var_value(char_u *name) v = find_var(name, NULL, FALSE); if (v == NULL) return NULL; - return get_tv_string(&v->di_tv); + return tv_get_string(&v->di_tv); } /* @@ -7544,7 +7544,7 @@ set_var( { vim_free(v->di_tv.vval.v_string); if (copy || tv->v_type != VAR_STRING) - v->di_tv.vval.v_string = vim_strsave(get_tv_string(tv)); + v->di_tv.vval.v_string = vim_strsave(tv_get_string(tv)); else { /* Take over the string to avoid an extra alloc/free. */ @@ -7555,7 +7555,7 @@ set_var( } else if (v->di_tv.v_type == VAR_NUMBER) { - v->di_tv.vval.v_number = get_tv_number(tv); + v->di_tv.vval.v_number = tv_get_number(tv); if (STRCMP(varname, "searchforward") == 0) set_search_direction(v->di_tv.vval.v_number ? '/' : '?'); #ifdef FEAT_SEARCH_EXTRA @@ -7894,7 +7894,7 @@ get_user_input( int inputdialog, int secret) { - char_u *prompt = get_tv_string_chk(&argvars[0]); + char_u *prompt = tv_get_string_chk(&argvars[0]); char_u *p = NULL; int c; char_u buf[NUMBUFLEN]; @@ -7937,7 +7937,7 @@ get_user_input( if (argvars[1].v_type != VAR_UNKNOWN) { - defstr = get_tv_string_buf_chk(&argvars[1], buf); + defstr = tv_get_string_buf_chk(&argvars[1], buf); if (defstr != NULL) stuffReadbuffSpec(defstr); @@ -7950,7 +7950,7 @@ get_user_input( /* input() with a third argument: completion */ rettv->vval.v_string = NULL; - xp_name = get_tv_string_buf_chk(&argvars[2], buf); + xp_name = tv_get_string_buf_chk(&argvars[2], buf); if (xp_name == NULL) return; @@ -7975,7 +7975,7 @@ get_user_input( if (inputdialog && rettv->vval.v_string == NULL && argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(get_tv_string_buf( + rettv->vval.v_string = vim_strsave(tv_get_string_buf( &argvars[2], buf)); vim_free(xp_arg); @@ -8142,7 +8142,7 @@ ex_execute(exarg_T *eap) if (!eap->skip) { - p = get_tv_string(&rettv); + p = tv_get_string(&rettv); len = (int)STRLEN(p); if (ga_grow(&ga, len + 2) == FAIL) { @@ -8205,7 +8205,7 @@ find_win_by_nr( tabpage_T *tp) /* NULL for current tab page */ { win_T *wp; - int nr = (int)get_tv_number_chk(vp, NULL); + int nr = (int)tv_get_number_chk(vp, NULL); if (nr < 0) return NULL; @@ -8234,7 +8234,7 @@ find_win_by_nr( win_T * find_win_by_nr_or_id(typval_T *vp) { - int nr = (int)get_tv_number_chk(vp, NULL); + int nr = (int)tv_get_number_chk(vp, NULL); if (nr >= LOWEST_WIN_ID) return win_id2wp(vp); @@ -8257,7 +8257,7 @@ find_tabwin( { if (tvp->v_type != VAR_UNKNOWN) { - n = (long)get_tv_number(tvp); + n = (long)tv_get_number(tvp); if (n >= 0) tp = find_tabpage(n); } @@ -8292,11 +8292,11 @@ getwinvar( int need_switch_win; if (off == 1) - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); else tp = curtab; win = find_win_by_nr(&argvars[off], tp); - varname = get_tv_string_chk(&argvars[off + 1]); + varname = tv_get_string_chk(&argvars[off + 1]); ++emsg_off; rettv->v_type = VAR_STRING; @@ -8373,11 +8373,11 @@ setwinvar(typval_T *argvars, typval_T *rettv UNUSED, int off) return; if (off == 1) - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); else tp = curtab; win = find_win_by_nr(&argvars[off], tp); - varname = get_tv_string_chk(&argvars[off + 1]); + varname = tv_get_string_chk(&argvars[off + 1]); varp = &argvars[off + 2]; if (win != NULL && varname != NULL && varp != NULL) @@ -8393,8 +8393,8 @@ setwinvar(typval_T *argvars, typval_T *rettv UNUSED, int off) int error = FALSE; ++varname; - numval = (long)get_tv_number_chk(varp, &error); - strval = get_tv_string_buf_chk(varp, nbuf); + numval = (long)tv_get_number_chk(varp, &error); + strval = tv_get_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); } @@ -8697,7 +8697,7 @@ store_session_globals(FILE *fd) { /* Escape special characters with a backslash. Turn a LF and * CR into \n and \r. */ - p = vim_strsave_escaped(get_tv_string(&this_var->di_tv), + p = vim_strsave_escaped(tv_get_string(&this_var->di_tv), (char_u *)"\\\"\n\r"); if (p == NULL) /* out of memory */ break; @@ -8842,8 +8842,8 @@ assert_equalfile(typval_T *argvars) { char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; - char_u *fname1 = get_tv_string_buf_chk(&argvars[0], buf1); - char_u *fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + char_u *fname1 = tv_get_string_buf_chk(&argvars[0], buf1); + char_u *fname2 = tv_get_string_buf_chk(&argvars[1], buf2); garray_T ga; FILE *fd1; FILE *fd2; @@ -8914,8 +8914,8 @@ assert_match_common(typval_T *argvars, assert_type_T atype) garray_T ga; char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; - char_u *pat = get_tv_string_buf_chk(&argvars[0], buf1); - char_u *text = get_tv_string_buf_chk(&argvars[1], buf2); + char_u *pat = tv_get_string_buf_chk(&argvars[0], buf1); + char_u *text = tv_get_string_buf_chk(&argvars[1], buf2); if (pat == NULL || text == NULL) EMSG(_(e_invarg)); @@ -8936,9 +8936,9 @@ assert_inrange(typval_T *argvars) { garray_T ga; int error = FALSE; - varnumber_T lower = get_tv_number_chk(&argvars[0], &error); - varnumber_T upper = get_tv_number_chk(&argvars[1], &error); - varnumber_T actual = get_tv_number_chk(&argvars[2], &error); + varnumber_T lower = tv_get_number_chk(&argvars[0], &error); + varnumber_T upper = tv_get_number_chk(&argvars[1], &error); + varnumber_T actual = tv_get_number_chk(&argvars[2], &error); char_u *tofree; char msg[200]; char_u numbuf[NUMBUFLEN]; @@ -8980,7 +8980,7 @@ assert_bool(typval_T *argvars, int isTrue) && argvars[0].vval.v_number == (isTrue ? VVAL_TRUE : VVAL_FALSE)) return 0; if (argvars[0].v_type != VAR_NUMBER - || (get_tv_number_chk(&argvars[0], &error) == 0) == isTrue + || (tv_get_number_chk(&argvars[0], &error) == 0) == isTrue || error) { prepare_assert_error(&ga); @@ -9000,7 +9000,7 @@ assert_report(typval_T *argvars) garray_T ga; prepare_assert_error(&ga); - ga_concat(&ga, get_tv_string(&argvars[0])); + ga_concat(&ga, tv_get_string(&argvars[0])); assert_error(&ga); ga_clear(&ga); return 1; @@ -9010,7 +9010,7 @@ assert_report(typval_T *argvars) assert_exception(typval_T *argvars) { garray_T ga; - char_u *error = get_tv_string_chk(&argvars[0]); + char_u *error = tv_get_string_chk(&argvars[0]); if (vimvars[VV_EXCEPTION].vv_str == NULL) { @@ -9036,7 +9036,7 @@ assert_exception(typval_T *argvars) int assert_beeps(typval_T *argvars) { - char_u *cmd = get_tv_string_chk(&argvars[0]); + char_u *cmd = tv_get_string_chk(&argvars[0]); garray_T ga; int ret = 0; @@ -9062,7 +9062,7 @@ assert_beeps(typval_T *argvars) int assert_fails(typval_T *argvars) { - char_u *cmd = get_tv_string_chk(&argvars[0]); + char_u *cmd = tv_get_string_chk(&argvars[0]); garray_T ga; int ret = 0; char_u numbuf[NUMBUFLEN]; @@ -9091,7 +9091,7 @@ assert_fails(typval_T *argvars) else if (argvars[1].v_type != VAR_UNKNOWN) { char_u buf[NUMBUFLEN]; - char *error = (char *)get_tv_string_buf_chk(&argvars[1], buf); + char *error = (char *)tv_get_string_buf_chk(&argvars[1], buf); if (error == NULL || strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL) @@ -9325,11 +9325,11 @@ typval_compare( if (typ1->v_type == VAR_FLOAT) f1 = typ1->vval.v_float; else - f1 = get_tv_number(typ1); + f1 = tv_get_number(typ1); if (typ2->v_type == VAR_FLOAT) f2 = typ2->vval.v_float; else - f2 = get_tv_number(typ2); + f2 = tv_get_number(typ2); n1 = FALSE; switch (type) { @@ -9353,8 +9353,8 @@ typval_compare( else if ((typ1->v_type == VAR_NUMBER || typ2->v_type == VAR_NUMBER) && type != TYPE_MATCH && type != TYPE_NOMATCH) { - n1 = get_tv_number(typ1); - n2 = get_tv_number(typ2); + n1 = tv_get_number(typ1); + n2 = tv_get_number(typ2); switch (type) { case TYPE_EQUAL: n1 = (n1 == n2); break; @@ -9370,8 +9370,8 @@ typval_compare( } else { - s1 = get_tv_string_buf(typ1, buf1); - s2 = get_tv_string_buf(typ2, buf2); + s1 = tv_get_string_buf(typ1, buf1); + s2 = tv_get_string_buf(typ2, buf2); if (type != TYPE_MATCH && type != TYPE_NOMATCH) i = ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2); else @@ -10220,10 +10220,10 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp) int error = FALSE; /* filter(): when expr is zero remove the item */ - *remp = (get_tv_number_chk(&rettv, &error) == 0); + *remp = (tv_get_number_chk(&rettv, &error) == 0); clear_tv(&rettv); /* On type error, nothing has been removed; return FAIL to stop the - * loop. The error message was given by get_tv_number_chk(). */ + * loop. The error message was given by tv_get_number_chk(). */ if (error) goto theend; } diff --git a/src/evalfunc.c b/src/evalfunc.c index 15c625c8b..cbe2a4ebb 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1133,12 +1133,12 @@ non_zero_arg(typval_T *argvars) * Returns -1 on error. */ static linenr_T -get_tv_lnum(typval_T *argvars) +tv_get_lnum(typval_T *argvars) { typval_T rettv; linenr_T lnum; - lnum = (linenr_T)get_tv_number_chk(&argvars[0], NULL); + lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); if (lnum == 0) /* no valid number, try using line() */ { rettv.v_type = VAR_NUMBER; @@ -1149,6 +1149,22 @@ get_tv_lnum(typval_T *argvars) return lnum; } +/* + * Get the lnum from the first argument. + * Also accepts "$", then "buf" is used. + * Returns 0 on error. + */ + static linenr_T +tv_get_lnum_buf(typval_T *argvars, buf_T *buf) +{ + if (argvars[0].v_type == VAR_STRING + && argvars[0].vval.v_string != NULL + && argvars[0].vval.v_string[0] == '$' + && buf != NULL) + return buf->b_ml.ml_line_count; + return (linenr_T)tv_get_number_chk(&argvars[0], NULL); +} + #ifdef FEAT_FLOAT /* * Get the float value of "argvars[0]" into "f". @@ -1187,7 +1203,7 @@ f_abs(typval_T *argvars, typval_T *rettv) varnumber_T n; int error = FALSE; - n = get_tv_number_chk(&argvars[0], &error); + n = tv_get_number_chk(&argvars[0], &error); if (error) rettv->vval.v_number = -1; else if (n > 0) @@ -1240,24 +1256,8 @@ f_add(typval_T *argvars, typval_T *rettv) static void f_and(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - & get_tv_number_chk(&argvars[1], NULL); -} - -/* - * Get the lnum from the first argument. - * Also accepts "$", then "buf" is used. - * Returns 0 on error. - */ - static linenr_T -get_tv_lnum_buf(typval_T *argvars, buf_T *buf) -{ - if (argvars[0].v_type == VAR_STRING - && argvars[0].vval.v_string != NULL - && argvars[0].vval.v_string[0] == '$' - && buf != NULL) - return buf->b_ml.ml_line_count; - return (linenr_T)get_tv_number_chk(&argvars[0], NULL); + rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) + & tv_get_number_chk(&argvars[1], NULL); } /* @@ -1330,7 +1330,7 @@ set_buffer_lines( li = l->lv_first; } else - line = get_tv_string_chk(lines); + line = tv_get_string_chk(lines); /* default result is zero == OK */ for (;;) @@ -1340,7 +1340,7 @@ set_buffer_lines( /* list argument, get next string */ if (li == NULL) break; - line = get_tv_string_chk(&li->li_tv); + line = tv_get_string_chk(&li->li_tv); li = li->li_next; } @@ -1411,7 +1411,7 @@ set_buffer_lines( static void f_append(typval_T *argvars, typval_T *rettv) { - linenr_T lnum = get_tv_lnum(&argvars[0]); + linenr_T lnum = tv_get_lnum(&argvars[0]); set_buffer_lines(curbuf, lnum, TRUE, &argvars[1], rettv); } @@ -1430,7 +1430,7 @@ f_appendbufline(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 1; /* FAIL */ else { - lnum = get_tv_lnum_buf(&argvars[1], buf); + lnum = tv_get_lnum_buf(&argvars[1], buf); set_buffer_lines(buf, lnum, TRUE, &argvars[2], rettv); } } @@ -1447,7 +1447,7 @@ f_argc(typval_T *argvars, typval_T *rettv) // use the current window rettv->vval.v_number = ARGCOUNT; else if (argvars[0].v_type == VAR_NUMBER - && get_tv_number(&argvars[0]) == -1) + && tv_get_number(&argvars[0]) == -1) // use the global argument list rettv->vval.v_number = GARGCOUNT; else @@ -1516,7 +1516,7 @@ f_argv(typval_T *argvars, typval_T *rettv) argcount = ARGCOUNT; } else if (argvars[1].v_type == VAR_NUMBER - && get_tv_number(&argvars[1]) == -1) + && tv_get_number(&argvars[1]) == -1) { arglist = GARGLIST; argcount = GARGCOUNT; @@ -1535,7 +1535,7 @@ f_argv(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - idx = get_tv_number_chk(&argvars[0], NULL); + idx = tv_get_number_chk(&argvars[0], NULL); if (arglist != NULL && idx >= 0 && idx < argcount) rettv->vval.v_string = vim_strsave(alist_name(&arglist[idx])); else if (idx == -1) @@ -1717,7 +1717,7 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) ) post_balloon(balloonEval, NULL, argvars[0].vval.v_list); else - post_balloon(balloonEval, get_tv_string_chk(&argvars[0]), NULL); + post_balloon(balloonEval, tv_get_string_chk(&argvars[0]), NULL); } } @@ -1727,7 +1727,7 @@ f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) { if (rettv_list_alloc(rettv) == OK) { - char_u *msg = get_tv_string_chk(&argvars[0]); + char_u *msg = tv_get_string_chk(&argvars[0]); if (msg != NULL) { @@ -1762,10 +1762,10 @@ f_browse(typval_T *argvars UNUSED, typval_T *rettv) char_u buf2[NUMBUFLEN]; int error = FALSE; - save = (int)get_tv_number_chk(&argvars[0], &error); - title = get_tv_string_chk(&argvars[1]); - initdir = get_tv_string_buf_chk(&argvars[2], buf); - defname = get_tv_string_buf_chk(&argvars[3], buf2); + save = (int)tv_get_number_chk(&argvars[0], &error); + title = tv_get_string_chk(&argvars[1]); + initdir = tv_get_string_buf_chk(&argvars[2], buf); + defname = tv_get_string_buf_chk(&argvars[3], buf2); if (error || title == NULL || initdir == NULL || defname == NULL) rettv->vval.v_string = NULL; @@ -1790,8 +1790,8 @@ f_browsedir(typval_T *argvars UNUSED, typval_T *rettv) char_u *initdir; char_u buf[NUMBUFLEN]; - title = get_tv_string_chk(&argvars[0]); - initdir = get_tv_string_buf_chk(&argvars[1], buf); + title = tv_get_string_chk(&argvars[0]); + initdir = tv_get_string_buf_chk(&argvars[1], buf); if (title == NULL || initdir == NULL) rettv->vval.v_string = NULL; @@ -1924,7 +1924,7 @@ f_bufname(typval_T *argvars, typval_T *rettv) { buf_T *buf; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); rettv->v_type = VAR_STRING; @@ -1945,7 +1945,7 @@ f_bufnr(typval_T *argvars, typval_T *rettv) int error = FALSE; char_u *name; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); --emsg_off; @@ -1954,9 +1954,9 @@ f_bufnr(typval_T *argvars, typval_T *rettv) * new buffer. */ if (buf == NULL && argvars[1].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[1], &error) != 0 + && tv_get_number_chk(&argvars[1], &error) != 0 && !error - && (name = get_tv_string_chk(&argvars[0])) != NULL + && (name = tv_get_string_chk(&argvars[0])) != NULL && !error) buf = buflist_new(name, NULL, (linenr_T)1, 0); @@ -1973,7 +1973,7 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr) int winnr = 0; buf_T *buf; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], TRUE); FOR_ALL_WINDOWS(wp) @@ -2015,7 +2015,7 @@ f_byte2line(typval_T *argvars UNUSED, typval_T *rettv) #else long boff = 0; - boff = get_tv_number(&argvars[0]) - 1; /* boff gets -1 on type error */ + boff = tv_get_number(&argvars[0]) - 1; /* boff gets -1 on type error */ if (boff < 0) rettv->vval.v_number = -1; else @@ -2033,8 +2033,8 @@ byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED) char_u *str; varnumber_T idx; - str = get_tv_string_chk(&argvars[0]); - idx = get_tv_number_chk(&argvars[1], NULL); + str = tv_get_string_chk(&argvars[0]); + idx = tv_get_number_chk(&argvars[1], NULL); rettv->vval.v_number = -1; if (str == NULL || idx < 0) return; @@ -2101,7 +2101,7 @@ f_call(typval_T *argvars, typval_T *rettv) func = partial_name(partial); } else - func = get_tv_string(&argvars[0]); + func = tv_get_string(&argvars[0]); if (*func == NUL) return; /* type error or empty name */ @@ -2189,7 +2189,7 @@ f_ch_getbufnr(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; if (channel != NULL) { - char_u *what = get_tv_string(&argvars[1]); + char_u *what = tv_get_string(&argvars[1]); int part; if (STRCMP(what, "err") == 0) @@ -2241,7 +2241,7 @@ f_ch_info(typval_T *argvars, typval_T *rettv UNUSED) static void f_ch_log(typval_T *argvars, typval_T *rettv UNUSED) { - char_u *msg = get_tv_string(&argvars[0]); + char_u *msg = tv_get_string(&argvars[0]); channel_T *channel = NULL; if (argvars[1].v_type != VAR_UNKNOWN) @@ -2263,9 +2263,9 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) /* Don't open a file in restricted mode. */ if (check_restricted() || check_secure()) return; - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); if (argvars[1].v_type == VAR_STRING) - opt = get_tv_string_buf(&argvars[1], buf); + opt = tv_get_string_buf(&argvars[1], buf); ch_logfile(fname, opt); } @@ -2403,16 +2403,16 @@ f_char2nr(typval_T *argvars, typval_T *rettv) int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) - utf8 = (int)get_tv_number_chk(&argvars[1], NULL); + utf8 = (int)tv_get_number_chk(&argvars[1], NULL); if (utf8) - rettv->vval.v_number = (*utf_ptr2char)(get_tv_string(&argvars[0])); + rettv->vval.v_number = (*utf_ptr2char)(tv_get_string(&argvars[0])); else - rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0])); + rettv->vval.v_number = (*mb_ptr2char)(tv_get_string(&argvars[0])); } else #endif - rettv->vval.v_number = get_tv_string(&argvars[0])[0]; + rettv->vval.v_number = tv_get_string(&argvars[0])[0]; } /* @@ -2426,7 +2426,7 @@ f_cindent(typval_T *argvars UNUSED, typval_T *rettv) linenr_T lnum; pos = curwin->w_cursor; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = lnum; @@ -2526,7 +2526,7 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED) return; } - startcol = (int)get_tv_number_chk(&argvars[0], NULL); + startcol = (int)tv_get_number_chk(&argvars[0], NULL); if (startcol <= 0) return; @@ -2573,20 +2573,20 @@ f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) char_u *typestr; int error = FALSE; - message = get_tv_string_chk(&argvars[0]); + message = tv_get_string_chk(&argvars[0]); if (message == NULL) error = TRUE; if (argvars[1].v_type != VAR_UNKNOWN) { - buttons = get_tv_string_buf_chk(&argvars[1], buf); + buttons = tv_get_string_buf_chk(&argvars[1], buf); if (buttons == NULL) error = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) { - def = (int)get_tv_number_chk(&argvars[2], &error); + def = (int)tv_get_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { - typestr = get_tv_string_buf_chk(&argvars[3], buf2); + typestr = tv_get_string_buf_chk(&argvars[3], buf2); if (typestr == NULL) error = TRUE; else @@ -2665,11 +2665,11 @@ f_count(typval_T *argvars, typval_T *rettv) int error = FALSE; if (argvars[2].v_type != VAR_UNKNOWN) - ic = (int)get_tv_number_chk(&argvars[2], &error); + ic = (int)tv_get_number_chk(&argvars[2], &error); if (argvars[0].v_type == VAR_STRING) { - char_u *expr = get_tv_string_chk(&argvars[1]); + char_u *expr = tv_get_string_chk(&argvars[1]); char_u *p = argvars[0].vval.v_string; char_u *next; @@ -2713,7 +2713,7 @@ f_count(typval_T *argvars, typval_T *rettv) { if (argvars[3].v_type != VAR_UNKNOWN) { - idx = (long)get_tv_number_chk(&argvars[3], &error); + idx = (long)tv_get_number_chk(&argvars[3], &error); if (!error) { li = list_find(l, idx); @@ -2778,10 +2778,10 @@ f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (argvars[0].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_UNKNOWN) { - num = (int)get_tv_number(&argvars[0]); - dbpath = get_tv_string(&argvars[1]); + num = (int)tv_get_number(&argvars[0]); + dbpath = tv_get_string(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) - prepend = get_tv_string_buf(&argvars[2], buf); + prepend = tv_get_string_buf(&argvars[2], buf); } rettv->vval.v_number = cs_connection(num, dbpath, prepend); @@ -2828,11 +2828,11 @@ f_cursor(typval_T *argvars, typval_T *rettv) } else { - line = get_tv_lnum(argvars); - col = (long)get_tv_number_chk(&argvars[1], NULL); + line = tv_get_lnum(argvars); + col = (long)tv_get_number_chk(&argvars[1], NULL); #ifdef FEAT_VIRTUALEDIT if (argvars[2].v_type != VAR_UNKNOWN) - coladd = (long)get_tv_number_chk(&argvars[2], NULL); + coladd = (long)tv_get_number_chk(&argvars[2], NULL); #endif } if (line < 0 || col < 0 @@ -2871,7 +2871,7 @@ f_debugbreak(typval_T *argvars, typval_T *rettv) int pid; rettv->vval.v_number = FAIL; - pid = (int)get_tv_number(&argvars[0]); + pid = (int)tv_get_number(&argvars[0]); if (pid == 0) EMSG(_(e_invarg)); else @@ -2898,7 +2898,7 @@ f_deepcopy(typval_T *argvars, typval_T *rettv) int copyID; if (argvars[1].v_type != VAR_UNKNOWN) - noref = (int)get_tv_number_chk(&argvars[1], NULL); + noref = (int)tv_get_number_chk(&argvars[1], NULL); if (noref < 0 || noref > 1) EMSG(_(e_invarg)); else @@ -2922,7 +2922,7 @@ f_delete(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (name == NULL || *name == NUL) { EMSG(_(e_invarg)); @@ -2930,7 +2930,7 @@ f_delete(typval_T *argvars, typval_T *rettv) } if (argvars[1].v_type != VAR_UNKNOWN) - flags = get_tv_string_buf(&argvars[1], nbuf); + flags = tv_get_string_buf(&argvars[1], nbuf); else flags = (char_u *)""; @@ -2971,9 +2971,9 @@ f_deletebufline(typval_T *argvars, typval_T *rettv) } is_curbuf = buf == curbuf; - first = get_tv_lnum_buf(&argvars[1], buf); + first = tv_get_lnum_buf(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) - last = get_tv_lnum_buf(&argvars[2], buf); + last = tv_get_lnum_buf(&argvars[2], buf); else last = first; @@ -3048,7 +3048,7 @@ f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_DIFF - rettv->vval.v_number = diff_check_fill(curwin, get_tv_lnum(argvars)); + rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars)); #endif } @@ -3059,7 +3059,7 @@ f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_DIFF - linenr_T lnum = get_tv_lnum(argvars); + linenr_T lnum = tv_get_lnum(argvars); static linenr_T prev_lnum = 0; static varnumber_T changedtick = 0; static int fnum = 0; @@ -3100,7 +3100,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (hlID == HLF_CHD || hlID == HLF_TXD) { - col = get_tv_number(&argvars[1]) - 1; /* ignore type error in {col} */ + col = tv_get_number(&argvars[1]) - 1; /* ignore type error in {col} */ if (col >= change_start && col <= change_end) hlID = HLF_TXD; /* changed text */ else @@ -3177,8 +3177,8 @@ f_escape(typval_T *argvars, typval_T *rettv) { char_u buf[NUMBUFLEN]; - rettv->vval.v_string = vim_strsave_escaped(get_tv_string(&argvars[0]), - get_tv_string_buf(&argvars[1], buf)); + rettv->vval.v_string = vim_strsave_escaped(tv_get_string(&argvars[0]), + tv_get_string_buf(&argvars[1], buf)); rettv->v_type = VAR_STRING; } @@ -3190,7 +3190,7 @@ f_eval(typval_T *argvars, typval_T *rettv) { char_u *s, *p; - s = get_tv_string_chk(&argvars[0]); + s = tv_get_string_chk(&argvars[0]); if (s != NULL) s = skipwhite(s); @@ -3222,7 +3222,7 @@ f_eventhandler(typval_T *argvars UNUSED, typval_T *rettv) static void f_executable(typval_T *argvars, typval_T *rettv) { - char_u *name = get_tv_string(&argvars[0]); + char_u *name = tv_get_string(&argvars[0]); /* Check in $PATH and also check directly if there is a directory name. */ rettv->vval.v_number = mch_can_exe(name, NULL, TRUE) @@ -3270,7 +3270,7 @@ get_list_line( if (item == NULL) return NULL; - s = get_tv_string_buf_chk(&item->li_tv, buf); + s = tv_get_string_buf_chk(&item->li_tv, buf); *p = item->li_next; return s == NULL ? NULL : vim_strsave(s); } @@ -3305,7 +3305,7 @@ f_execute(typval_T *argvars, typval_T *rettv) } else { - cmd = get_tv_string_chk(&argvars[0]); + cmd = tv_get_string_chk(&argvars[0]); if (cmd == NULL) return; } @@ -3313,7 +3313,7 @@ f_execute(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { char_u buf[NUMBUFLEN]; - char_u *s = get_tv_string_buf_chk(&argvars[1], buf); + char_u *s = tv_get_string_buf_chk(&argvars[1], buf); if (s == NULL) return; @@ -3388,7 +3388,7 @@ f_exepath(typval_T *argvars, typval_T *rettv) { char_u *p = NULL; - (void)mch_can_exe(get_tv_string(&argvars[0]), &p, TRUE); + (void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE); rettv->v_type = VAR_STRING; rettv->vval.v_string = p; } @@ -3402,7 +3402,7 @@ f_exists(typval_T *argvars, typval_T *rettv) char_u *p; int n = FALSE; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); if (*p == '$') /* environment variable */ { /* first try "normal" environment variables (fast) */ @@ -3480,13 +3480,13 @@ f_expand(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[2], &error) + && tv_get_number_chk(&argvars[2], &error) && !error) { rettv_list_set(rettv, NULL); } - s = get_tv_string(&argvars[0]); + s = tv_get_string(&argvars[0]); if (*s == '%' || *s == '#' || *s == '<') { ++emsg_off; @@ -3507,7 +3507,7 @@ f_expand(typval_T *argvars, typval_T *rettv) /* When the optional second argument is non-zero, don't remove matches * for 'wildignore' and don't put matches for 'suffixes' at the end. */ if (argvars[1].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[1], &error)) + && tv_get_number_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; if (!error) { @@ -3556,7 +3556,7 @@ f_extend(typval_T *argvars, typval_T *rettv) { if (argvars[2].v_type != VAR_UNKNOWN) { - before = (long)get_tv_number_chk(&argvars[2], &error); + before = (long)tv_get_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ @@ -3595,7 +3595,7 @@ f_extend(typval_T *argvars, typval_T *rettv) { static char *(av[]) = {"keep", "force", "error"}; - action = get_tv_string_chk(&argvars[2]); + action = tv_get_string_chk(&argvars[2]); if (action == NULL) return; /* type error; errmsg already given */ for (i = 0; i < 3; ++i) @@ -3640,11 +3640,11 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - keys = get_tv_string(&argvars[0]); + keys = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - flags = get_tv_string_buf(&argvars[1], nbuf); + flags = tv_get_string_buf(&argvars[1], nbuf); for ( ; *flags != NUL; ++flags) { switch (*flags) @@ -3707,7 +3707,7 @@ f_filereadable(typval_T *argvars, typval_T *rettv) #ifndef O_NONBLOCK # define O_NONBLOCK 0 #endif - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); if (*p && !mch_isdir(p) && (fd = mch_open((char *)p, O_RDONLY | O_NONBLOCK, 0)) >= 0) { @@ -3727,7 +3727,7 @@ f_filereadable(typval_T *argvars, typval_T *rettv) static void f_filewritable(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = filewritable(get_tv_string(&argvars[0])); + rettv->vval.v_number = filewritable(tv_get_string(&argvars[0])); } static void @@ -3751,11 +3751,11 @@ findfilendir( rettv->v_type = VAR_STRING; #ifdef FEAT_SEARCHPATH - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - p = get_tv_string_buf_chk(&argvars[1], pathbuf); + p = tv_get_string_buf_chk(&argvars[1], pathbuf); if (p == NULL) error = TRUE; else @@ -3764,7 +3764,7 @@ findfilendir( path = p; if (argvars[2].v_type != VAR_UNKNOWN) - count = (int)get_tv_number_chk(&argvars[2], &error); + count = (int)tv_get_number_chk(&argvars[2], &error); } } @@ -3883,7 +3883,7 @@ f_fmod(typval_T *argvars, typval_T *rettv) f_fnameescape(typval_T *argvars, typval_T *rettv) { rettv->vval.v_string = vim_strsave_fnameescape( - get_tv_string(&argvars[0]), FALSE); + tv_get_string(&argvars[0]), FALSE); rettv->v_type = VAR_STRING; } @@ -3900,8 +3900,8 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv) char_u *fbuf = NULL; char_u buf[NUMBUFLEN]; - fname = get_tv_string_chk(&argvars[0]); - mods = get_tv_string_buf_chk(&argvars[1], buf); + fname = tv_get_string_chk(&argvars[0]); + mods = tv_get_string_buf_chk(&argvars[1], buf); if (fname == NULL || mods == NULL) fname = NULL; else @@ -3931,7 +3931,7 @@ foldclosed_both( linenr_T lnum; linenr_T first, last; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) { if (hasFoldingWin(curwin, lnum, &first, &last, FALSE, NULL)) @@ -3974,7 +3974,7 @@ f_foldlevel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) #ifdef FEAT_FOLDING linenr_T lnum; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) rettv->vval.v_number = foldLevel(lnum); #endif @@ -4067,7 +4067,7 @@ f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) return; /* reject recursive use */ entered = TRUE; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); /* treat illegal types and illegal string values for {lnum} the same */ if (lnum < 0) lnum = 0; @@ -4125,7 +4125,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) else { /* function('MyFunc', [arg], dict) */ - s = get_tv_string(&argvars[0]); + s = tv_get_string(&argvars[0]); use_string = TRUE; } @@ -4140,7 +4140,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) || (is_funcref && trans_name == NULL)) - EMSG2(_(e_invarg2), use_string ? get_tv_string(&argvars[0]) : s); + EMSG2(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s); /* Don't check an autoload name for existence here. */ else if (trans_name != NULL && (is_funcref ? find_func(trans_name) == NULL @@ -4327,7 +4327,7 @@ f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED) * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ want_garbage_collect = TRUE; - if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1) + if (argvars[0].v_type != VAR_UNKNOWN && tv_get_number(&argvars[0]) == 1) garbage_collect_at_exit = TRUE; } @@ -4349,7 +4349,7 @@ f_get(typval_T *argvars, typval_T *rettv) { int error = FALSE; - li = list_find(l, (long)get_tv_number_chk(&argvars[1], &error)); + li = list_find(l, (long)tv_get_number_chk(&argvars[1], &error)); if (!error && li != NULL) tv = &li->li_tv; } @@ -4358,7 +4358,7 @@ f_get(typval_T *argvars, typval_T *rettv) { if ((d = argvars[0].vval.v_dict) != NULL) { - di = dict_find(d, get_tv_string(&argvars[1]), -1); + di = dict_find(d, tv_get_string(&argvars[1]), -1); if (di != NULL) tv = &di->di_tv; } @@ -4379,7 +4379,7 @@ f_get(typval_T *argvars, typval_T *rettv) if (pt != NULL) { - char_u *what = get_tv_string(&argvars[1]); + char_u *what = tv_get_string(&argvars[1]); char_u *n; if (STRCMP(what, "func") == 0 || STRCMP(what, "name") == 0) @@ -4527,22 +4527,22 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv) filtered = TRUE; di = dict_find(sel_d, (char_u *)"buflisted", -1); - if (di != NULL && get_tv_number(&di->di_tv)) + if (di != NULL && tv_get_number(&di->di_tv)) sel_buflisted = TRUE; di = dict_find(sel_d, (char_u *)"bufloaded", -1); - if (di != NULL && get_tv_number(&di->di_tv)) + if (di != NULL && tv_get_number(&di->di_tv)) sel_bufloaded = TRUE; di = dict_find(sel_d, (char_u *)"bufmodified", -1); - if (di != NULL && get_tv_number(&di->di_tv)) + if (di != NULL && tv_get_number(&di->di_tv)) sel_bufmodified = TRUE; } } else if (argvars[0].v_type != VAR_UNKNOWN) { /* Information about one buffer. Argument specifies the buffer */ - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; argbuf = get_buf_tv(&argvars[0], FALSE); --emsg_off; @@ -4626,16 +4626,16 @@ f_getbufline(typval_T *argvars, typval_T *rettv) linenr_T end; buf_T *buf; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); --emsg_off; - lnum = get_tv_lnum_buf(&argvars[1], buf); + lnum = tv_get_lnum_buf(&argvars[1], buf); if (argvars[2].v_type == VAR_UNKNOWN) end = lnum; else - end = get_tv_lnum_buf(&argvars[2], buf); + end = tv_get_lnum_buf(&argvars[2], buf); get_buffer_lines(buf, lnum, end, TRUE, rettv); } @@ -4652,8 +4652,8 @@ f_getbufvar(typval_T *argvars, typval_T *rettv) dictitem_T *v; int done = FALSE; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - varname = get_tv_string_chk(&argvars[1]); + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ + varname = tv_get_string_chk(&argvars[1]); ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); @@ -4724,7 +4724,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv) return; #ifdef FEAT_JUMPLIST - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); --emsg_off; @@ -4788,7 +4788,7 @@ f_getchar(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type == VAR_UNKNOWN) /* getchar(): blocking wait. */ n = plain_vgetc(); - else if (get_tv_number_chk(&argvars[0], &error) == 1) + else if (tv_get_number_chk(&argvars[0], &error) == 1) /* getchar(1): only check if char avail */ n = vpeekc_any(); else if (error || vpeekc_any() == NUL) @@ -4960,7 +4960,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) | WILD_NO_BEEP; if (argvars[2].v_type != VAR_UNKNOWN) - filtered = get_tv_number_chk(&argvars[2], NULL); + filtered = tv_get_number_chk(&argvars[2], NULL); if (p_wic) options |= WILD_ICASE; @@ -4970,9 +4970,9 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) options |= WILD_KEEP_ALL; ExpandInit(&xpc); - xpc.xp_pattern = get_tv_string(&argvars[0]); + xpc.xp_pattern = tv_get_string(&argvars[0]); xpc.xp_pattern_len = (int)STRLEN(xpc.xp_pattern); - xpc.xp_context = cmdcomplete_str_to_type(get_tv_string(&argvars[1])); + xpc.xp_context = cmdcomplete_str_to_type(tv_get_string(&argvars[1])); if (xpc.xp_context == EXPAND_NOTHING) { if (argvars[1].v_type == VAR_STRING) @@ -5083,7 +5083,7 @@ f_getfontname(typval_T *argvars UNUSED, typval_T *rettv) } else { - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (STRCMP(name, "*") == 0) /* don't use font dialog */ return; font = gui_mch_get_font(name, FALSE); @@ -5109,7 +5109,7 @@ f_getfperm(typval_T *argvars, typval_T *rettv) char_u flags[] = "rwx"; int i; - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); rettv->v_type = VAR_STRING; if (mch_stat((char *)fname, &st) >= 0) @@ -5136,7 +5136,7 @@ f_getfsize(typval_T *argvars, typval_T *rettv) char_u *fname; stat_T st; - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); rettv->v_type = VAR_NUMBER; @@ -5166,7 +5166,7 @@ f_getftime(typval_T *argvars, typval_T *rettv) char_u *fname; stat_T st; - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); if (mch_stat((char *)fname, &st) >= 0) rettv->vval.v_number = (varnumber_T)st.st_mtime; @@ -5185,7 +5185,7 @@ f_getftype(typval_T *argvars, typval_T *rettv) char_u *type = NULL; char *t; - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); rettv->v_type = VAR_STRING; if (mch_lstat((char *)fname, &st) >= 0) @@ -5272,7 +5272,7 @@ f_getline(typval_T *argvars, typval_T *rettv) linenr_T end; int retlist; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (argvars[1].v_type == VAR_UNKNOWN) { end = 0; @@ -5280,7 +5280,7 @@ f_getline(typval_T *argvars, typval_T *rettv) } else { - end = get_tv_lnum(&argvars[1]); + end = tv_get_lnum(&argvars[1]); retlist = TRUE; } @@ -5490,13 +5490,13 @@ f_getreg(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type != VAR_UNKNOWN) { - strregname = get_tv_string_chk(&argvars[0]); + strregname = tv_get_string_chk(&argvars[0]); error = strregname == NULL; if (argvars[1].v_type != VAR_UNKNOWN) { - arg2 = (int)get_tv_number_chk(&argvars[1], &error); + arg2 = (int)tv_get_number_chk(&argvars[1], &error); if (!error && argvars[2].v_type != VAR_UNKNOWN) - return_list = (int)get_tv_number_chk(&argvars[2], &error); + return_list = (int)tv_get_number_chk(&argvars[2], &error); } } else @@ -5540,7 +5540,7 @@ f_getregtype(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type != VAR_UNKNOWN) { - strregname = get_tv_string_chk(&argvars[0]); + strregname = tv_get_string_chk(&argvars[0]); if (strregname == NULL) /* type error; errmsg already given */ { rettv->v_type = VAR_STRING; @@ -5619,7 +5619,7 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv) if (argvars[0].v_type != VAR_UNKNOWN) { /* Information about one tab page */ - tparg = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + tparg = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); if (tparg == NULL) return; } @@ -5653,8 +5653,8 @@ f_gettabvar(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - varname = get_tv_string_chk(&argvars[1]); - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); + varname = tv_get_string_chk(&argvars[1]); + tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); if (tp != NULL && varname != NULL) { /* Set tp to be our tabpage, temporarily. Also set the window to the @@ -5879,7 +5879,7 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) varnumber_T timeout = 100; if (argvars[0].v_type != VAR_UNKNOWN) - timeout = get_tv_number(&argvars[0]); + timeout = tv_get_number(&argvars[0]); term_get_winpos(&x, &y, timeout); } #endif @@ -5966,16 +5966,16 @@ f_glob(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[1].v_type != VAR_UNKNOWN) { - if (get_tv_number_chk(&argvars[1], &error)) + if (tv_get_number_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; if (argvars[2].v_type != VAR_UNKNOWN) { - if (get_tv_number_chk(&argvars[2], &error)) + if (tv_get_number_chk(&argvars[2], &error)) { rettv_list_set(rettv, NULL); } if (argvars[3].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[3], &error)) + && tv_get_number_chk(&argvars[3], &error)) options |= WILD_ALLLINKS; } } @@ -5986,13 +5986,13 @@ f_glob(typval_T *argvars, typval_T *rettv) if (p_wic) options += WILD_ICASE; if (rettv->v_type == VAR_STRING) - rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), + rettv->vval.v_string = ExpandOne(&xpc, tv_get_string(&argvars[0]), NULL, options, WILD_ALL); else if (rettv_list_alloc(rettv) != FAIL) { int i; - ExpandOne(&xpc, get_tv_string(&argvars[0]), + ExpandOne(&xpc, tv_get_string(&argvars[0]), NULL, options, WILD_ALL_KEEP); for (i = 0; i < xpc.xp_numfiles; i++) list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); @@ -6012,7 +6012,7 @@ f_globpath(typval_T *argvars, typval_T *rettv) { int flags = 0; char_u buf1[NUMBUFLEN]; - char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); + char_u *file = tv_get_string_buf_chk(&argvars[1], buf1); int error = FALSE; garray_T ga; int i; @@ -6022,23 +6022,23 @@ f_globpath(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; if (argvars[2].v_type != VAR_UNKNOWN) { - if (get_tv_number_chk(&argvars[2], &error)) + if (tv_get_number_chk(&argvars[2], &error)) flags |= WILD_KEEP_ALL; if (argvars[3].v_type != VAR_UNKNOWN) { - if (get_tv_number_chk(&argvars[3], &error)) + if (tv_get_number_chk(&argvars[3], &error)) { rettv_list_set(rettv, NULL); } if (argvars[4].v_type != VAR_UNKNOWN - && get_tv_number_chk(&argvars[4], &error)) + && tv_get_number_chk(&argvars[4], &error)) flags |= WILD_ALLLINKS; } } if (file != NULL && !error) { ga_init2(&ga, (int)sizeof(char_u *), 10); - globpath(get_tv_string(&argvars[0]), file, &ga, flags); + globpath(tv_get_string(&argvars[0]), file, &ga, flags); if (rettv->v_type == VAR_STRING) rettv->vval.v_string = ga_concat_strings(&ga, "\n"); else if (rettv_list_alloc(rettv) != FAIL) @@ -6057,7 +6057,7 @@ f_globpath(typval_T *argvars, typval_T *rettv) static void f_glob2regpat(typval_T *argvars, typval_T *rettv) { - char_u *pat = get_tv_string_chk(&argvars[0]); + char_u *pat = tv_get_string_chk(&argvars[0]); rettv->v_type = VAR_STRING; rettv->vval.v_string = (pat == NULL) @@ -6583,7 +6583,7 @@ f_has(typval_T *argvars, typval_T *rettv) NULL }; - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); for (i = 0; has_list[i] != NULL; ++i) if (STRICMP(name, has_list[i]) == 0) { @@ -6721,7 +6721,7 @@ f_has_key(typval_T *argvars, typval_T *rettv) return; rettv->vval.v_number = dict_find(argvars[0].vval.v_dict, - get_tv_string(&argvars[1]), -1) != NULL; + tv_get_string(&argvars[1]), -1) != NULL; } /* @@ -6747,14 +6747,14 @@ f_hasmapto(typval_T *argvars, typval_T *rettv) char_u buf[NUMBUFLEN]; int abbr = FALSE; - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (argvars[1].v_type == VAR_UNKNOWN) mode = (char_u *)"nvo"; else { - mode = get_tv_string_buf(&argvars[1], buf); + mode = tv_get_string_buf(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) - abbr = (int)get_tv_number(&argvars[2]); + abbr = (int)tv_get_number(&argvars[2]); } if (map_to_exists(name, mode, abbr)) @@ -6779,11 +6779,11 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv) if (check_restricted() || check_secure()) return; #ifdef FEAT_CMDHIST - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + str = tv_get_string_chk(&argvars[0]); /* NULL on type error */ histype = str != NULL ? get_histtype(str) : -1; if (histype >= 0) { - str = get_tv_string_buf(&argvars[1], buf); + str = tv_get_string_buf(&argvars[1], buf); if (*str != NUL) { init_history(); @@ -6806,7 +6806,7 @@ f_histdel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) char_u buf[NUMBUFLEN]; char_u *str; - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + str = tv_get_string_chk(&argvars[0]); /* NULL on type error */ if (str == NULL) n = 0; else if (argvars[1].v_type == VAR_UNKNOWN) @@ -6815,11 +6815,11 @@ f_histdel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) else if (argvars[1].v_type == VAR_NUMBER) /* index given: remove that entry */ n = del_history_idx(get_histtype(str), - (int)get_tv_number(&argvars[1])); + (int)tv_get_number(&argvars[1])); else /* string given: remove all matching entries */ n = del_history_entry(get_histtype(str), - get_tv_string_buf(&argvars[1], buf)); + tv_get_string_buf(&argvars[1], buf)); rettv->vval.v_number = n; #endif } @@ -6835,7 +6835,7 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv) int idx; char_u *str; - str = get_tv_string_chk(&argvars[0]); /* NULL on type error */ + str = tv_get_string_chk(&argvars[0]); /* NULL on type error */ if (str == NULL) rettv->vval.v_string = NULL; else @@ -6844,7 +6844,7 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv) if (argvars[1].v_type == VAR_UNKNOWN) idx = get_history_idx(type); else - idx = (int)get_tv_number_chk(&argvars[1], NULL); + idx = (int)tv_get_number_chk(&argvars[1], NULL); /* -1 on type error */ rettv->vval.v_string = vim_strsave(get_history_entry(type, idx)); } @@ -6863,7 +6863,7 @@ f_histnr(typval_T *argvars UNUSED, typval_T *rettv) int i; #ifdef FEAT_CMDHIST - char_u *history = get_tv_string_chk(&argvars[0]); + char_u *history = tv_get_string_chk(&argvars[0]); i = history == NULL ? HIST_CMD - 1 : get_histtype(history); if (i >= HIST_CMD && i < HIST_COUNT) @@ -6880,7 +6880,7 @@ f_histnr(typval_T *argvars UNUSED, typval_T *rettv) static void f_hlID(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = syn_name2id(get_tv_string(&argvars[0])); + rettv->vval.v_number = syn_name2id(tv_get_string(&argvars[0])); } /* @@ -6889,7 +6889,7 @@ f_hlID(typval_T *argvars, typval_T *rettv) static void f_hlexists(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = highlight_exists(get_tv_string(&argvars[0])); + rettv->vval.v_number = highlight_exists(tv_get_string(&argvars[0])); } /* @@ -6922,9 +6922,9 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_string = NULL; #ifdef FEAT_MBYTE - str = get_tv_string(&argvars[0]); - from = enc_canonize(enc_skip(get_tv_string_buf(&argvars[1], buf1))); - to = enc_canonize(enc_skip(get_tv_string_buf(&argvars[2], buf2))); + str = tv_get_string(&argvars[0]); + from = enc_canonize(enc_skip(tv_get_string_buf(&argvars[1], buf1))); + to = enc_canonize(enc_skip(tv_get_string_buf(&argvars[2], buf2))); vimconv.vc_type = CONV_NONE; convert_setup(&vimconv, from, to); @@ -6948,7 +6948,7 @@ f_indent(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) rettv->vval.v_number = get_indent_lnum(lnum); else @@ -6982,10 +6982,10 @@ f_index(typval_T *argvars, typval_T *rettv) /* Start at specified item. Use the cached index that list_find() * sets, so that a negative number also works. */ - item = list_find(l, (long)get_tv_number_chk(&argvars[2], &error)); + item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); idx = l->lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) - ic = (int)get_tv_number_chk(&argvars[3], &error); + ic = (int)tv_get_number_chk(&argvars[3], &error); if (error) item = NULL; } @@ -7025,9 +7025,9 @@ f_inputdialog(typval_T *argvars, typval_T *rettv) char_u buf[NUMBUFLEN]; char_u *defstr = (char_u *)""; - message = get_tv_string_chk(&argvars[0]); + message = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN - && (defstr = get_tv_string_buf_chk(&argvars[1], buf)) != NULL) + && (defstr = tv_get_string_buf_chk(&argvars[1], buf)) != NULL) vim_strncpy(IObuff, defstr, IOSIZE - 1); else IObuff[0] = NUL; @@ -7041,7 +7041,7 @@ f_inputdialog(typval_T *argvars, typval_T *rettv) && argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) rettv->vval.v_string = vim_strsave( - get_tv_string_buf(&argvars[2], buf)); + tv_get_string_buf(&argvars[2], buf)); else rettv->vval.v_string = NULL; } @@ -7082,7 +7082,7 @@ f_inputlist(typval_T *argvars, typval_T *rettv) for (li = argvars[0].vval.v_list->lv_first; li != NULL; li = li->li_next) { - msg_puts(get_tv_string(&li->li_tv)); + msg_puts(tv_get_string(&li->li_tv)); msg_putchar('\n'); } @@ -7164,7 +7164,7 @@ f_insert(typval_T *argvars, typval_T *rettv) && !tv_check_lock(l->lv_lock, (char_u *)N_("insert() argument"), TRUE)) { if (argvars[2].v_type != VAR_UNKNOWN) - before = (long)get_tv_number_chk(&argvars[2], &error); + before = (long)tv_get_number_chk(&argvars[2], &error); if (error) return; /* type error; errmsg already given */ @@ -7193,7 +7193,7 @@ f_insert(typval_T *argvars, typval_T *rettv) static void f_invert(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = ~get_tv_number_chk(&argvars[0], NULL); + rettv->vval.v_number = ~tv_get_number_chk(&argvars[0], NULL); } /* @@ -7202,7 +7202,7 @@ f_invert(typval_T *argvars, typval_T *rettv) static void f_isdirectory(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = mch_isdir(get_tv_string(&argvars[0])); + rettv->vval.v_number = mch_isdir(tv_get_string(&argvars[0])); } /* @@ -7232,7 +7232,7 @@ f_islocked(typval_T *argvars, typval_T *rettv) dictitem_T *di; rettv->vval.v_number = -1; - end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE, + end = get_lval(tv_get_string(&argvars[0]), NULL, &lv, FALSE, FALSE, GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START); if (end != NULL && lv.ll_name != NULL) { @@ -7303,7 +7303,7 @@ get_job_arg(typval_T *tv) if (tv->v_type != VAR_JOB) { - EMSG2(_(e_invarg2), get_tv_string(tv)); + EMSG2(_(e_invarg2), tv_get_string(tv)); return NULL; } job = tv->vval.v_job; @@ -7423,7 +7423,7 @@ f_join(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type == VAR_UNKNOWN) sep = (char_u *)" "; else - sep = get_tv_string_chk(&argvars[1]); + sep = tv_get_string_chk(&argvars[1]); rettv->v_type = VAR_STRING; @@ -7446,7 +7446,7 @@ f_js_decode(typval_T *argvars, typval_T *rettv) { js_read_T reader; - reader.js_buf = get_tv_string(&argvars[0]); + reader.js_buf = tv_get_string(&argvars[0]); reader.js_fill = NULL; reader.js_used = 0; if (json_decode_all(&reader, rettv, JSON_JS) != OK) @@ -7471,7 +7471,7 @@ f_json_decode(typval_T *argvars, typval_T *rettv) { js_read_T reader; - reader.js_buf = get_tv_string(&argvars[0]); + reader.js_buf = tv_get_string(&argvars[0]); reader.js_fill = NULL; reader.js_used = 0; json_decode_all(&reader, rettv, 0); @@ -7523,7 +7523,7 @@ f_len(typval_T *argvars, typval_T *rettv) case VAR_STRING: case VAR_NUMBER: rettv->vval.v_number = (varnumber_T)STRLEN( - get_tv_string(&argvars[0])); + tv_get_string(&argvars[0])); break; case VAR_LIST: rettv->vval.v_number = list_len(argvars[0].vval.v_list); @@ -7627,7 +7627,7 @@ f_line2byte(typval_T *argvars UNUSED, typval_T *rettv) #else linenr_T lnum; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) rettv->vval.v_number = -1; else @@ -7648,7 +7648,7 @@ f_lispindent(typval_T *argvars UNUSED, typval_T *rettv) linenr_T lnum; pos = curwin->w_cursor; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count) { curwin->w_cursor.lnum = lnum; @@ -7687,18 +7687,18 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - keys = get_tv_string(&argvars[0]); + keys = tv_get_string(&argvars[0]); if (*keys == NUL) return; if (argvars[1].v_type != VAR_UNKNOWN) { - which = get_tv_string_buf_chk(&argvars[1], buf); + which = tv_get_string_buf_chk(&argvars[1], buf); if (argvars[2].v_type != VAR_UNKNOWN) { - abbr = (int)get_tv_number(&argvars[2]); + abbr = (int)tv_get_number(&argvars[2]); if (argvars[3].v_type != VAR_UNKNOWN) - get_dict = (int)get_tv_number(&argvars[3]); + get_dict = (int)tv_get_number(&argvars[3]); } } else @@ -7789,7 +7789,7 @@ f_luaeval(typval_T *argvars, typval_T *rettv) char_u *str; char_u buf[NUMBUFLEN]; - str = get_tv_string_buf(&argvars[0], buf); + str = tv_get_string_buf(&argvars[0], buf); do_luaeval(str, argvars + 1, rettv); } #endif @@ -7890,11 +7890,11 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) } else { - expr = str = get_tv_string(&argvars[0]); + expr = str = tv_get_string(&argvars[0]); len = (long)STRLEN(str); } - pat = get_tv_string_buf_chk(&argvars[1], patbuf); + pat = tv_get_string_buf_chk(&argvars[1], patbuf); if (pat == NULL) goto theend; @@ -7902,7 +7902,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) { int error = FALSE; - start = (long)get_tv_number_chk(&argvars[2], &error); + start = (long)tv_get_number_chk(&argvars[2], &error); if (error) goto theend; if (l != NULL) @@ -7931,7 +7931,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) } if (argvars[3].v_type != VAR_UNKNOWN) - nth = (long)get_tv_number_chk(&argvars[3], &error); + nth = (long)tv_get_number_chk(&argvars[3], &error); if (error) goto theend; } @@ -8106,8 +8106,8 @@ f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_SEARCH_EXTRA char_u buf[NUMBUFLEN]; - char_u *grp = get_tv_string_buf_chk(&argvars[0], buf); /* group */ - char_u *pat = get_tv_string_buf_chk(&argvars[1], buf); /* pattern */ + char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); /* group */ + char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); /* pattern */ int prio = 10; /* default priority */ int id = -1; int error = FALSE; @@ -8120,10 +8120,10 @@ f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) return; if (argvars[2].v_type != VAR_UNKNOWN) { - prio = (int)get_tv_number_chk(&argvars[2], &error); + prio = (int)tv_get_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { - id = (int)get_tv_number_chk(&argvars[3], &error); + id = (int)tv_get_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN && matchadd_dict_arg(&argvars[4], &conceal_char, &win) == FAIL) return; @@ -8160,7 +8160,7 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) rettv->vval.v_number = -1; - group = get_tv_string_buf_chk(&argvars[0], buf); + group = tv_get_string_buf_chk(&argvars[0], buf); if (group == NULL) return; @@ -8175,10 +8175,10 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (argvars[2].v_type != VAR_UNKNOWN) { - prio = (int)get_tv_number_chk(&argvars[2], &error); + prio = (int)tv_get_number_chk(&argvars[2], &error); if (argvars[3].v_type != VAR_UNKNOWN) { - id = (int)get_tv_number_chk(&argvars[3], &error); + id = (int)tv_get_number_chk(&argvars[3], &error); if (argvars[4].v_type != VAR_UNKNOWN && matchadd_dict_arg(&argvars[4], &conceal_char, &win) == FAIL) @@ -8209,7 +8209,7 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) if (rettv_list_alloc(rettv) == OK) { #ifdef FEAT_SEARCH_EXTRA - int id = (int)get_tv_number(&argvars[0]); + int id = (int)tv_get_number(&argvars[0]); matchitem_T *m; if (id >= 1 && id <= 3) @@ -8238,7 +8238,7 @@ f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_SEARCH_EXTRA rettv->vval.v_number = match_delete(curwin, - (int)get_tv_number(&argvars[0]), TRUE); + (int)tv_get_number(&argvars[0]), TRUE); #endif } @@ -8296,13 +8296,13 @@ max_min(typval_T *argvars, typval_T *rettv, int domax) li = l->lv_first; if (li != NULL) { - n = get_tv_number_chk(&li->li_tv, &error); + n = tv_get_number_chk(&li->li_tv, &error); for (;;) { li = li->li_next; if (li == NULL) break; - i = get_tv_number_chk(&li->li_tv, &error); + i = tv_get_number_chk(&li->li_tv, &error); if (domax ? i > n : i < n) n = i; } @@ -8325,7 +8325,7 @@ max_min(typval_T *argvars, typval_T *rettv, int domax) if (!HASHITEM_EMPTY(hi)) { --todo; - i = get_tv_number_chk(&HI2DI(hi)->di_tv, &error); + i = tv_get_number_chk(&HI2DI(hi)->di_tv, &error); if (first) { n = i; @@ -8405,7 +8405,7 @@ f_mkdir(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - dir = get_tv_string_buf(&argvars[0], buf); + dir = tv_get_string_buf(&argvars[0], buf); if (*dir == NUL) return; @@ -8417,11 +8417,11 @@ f_mkdir(typval_T *argvars, typval_T *rettv) { if (argvars[2].v_type != VAR_UNKNOWN) { - prot = (int)get_tv_number_chk(&argvars[2], NULL); + prot = (int)tv_get_number_chk(&argvars[2], NULL); if (prot == -1) return; } - if (STRCMP(get_tv_string(&argvars[1]), "p") == 0) + if (STRCMP(tv_get_string(&argvars[1]), "p") == 0) { if (mch_isdir(dir)) { @@ -8535,7 +8535,7 @@ f_mzeval(typval_T *argvars, typval_T *rettv) char_u *str; char_u buf[NUMBUFLEN]; - str = get_tv_string_buf(&argvars[0], buf); + str = tv_get_string_buf(&argvars[0], buf); do_mzeval(str, rettv); } @@ -8561,7 +8561,7 @@ f_nextnonblank(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - for (lnum = get_tv_lnum(argvars); ; ++lnum) + for (lnum = tv_get_lnum(argvars); ; ++lnum) { if (lnum < 0 || lnum > curbuf->b_ml.ml_line_count) { @@ -8588,16 +8588,16 @@ f_nr2char(typval_T *argvars, typval_T *rettv) int utf8 = 0; if (argvars[1].v_type != VAR_UNKNOWN) - utf8 = (int)get_tv_number_chk(&argvars[1], NULL); + utf8 = (int)tv_get_number_chk(&argvars[1], NULL); if (utf8) - buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; + buf[(*utf_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL; else - buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; + buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL; } else #endif { - buf[0] = (char_u)get_tv_number(&argvars[0]); + buf[0] = (char_u)tv_get_number(&argvars[0]); buf[1] = NUL; } rettv->v_type = VAR_STRING; @@ -8610,8 +8610,8 @@ f_nr2char(typval_T *argvars, typval_T *rettv) static void f_or(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - | get_tv_number_chk(&argvars[1], NULL); + rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) + | tv_get_number_chk(&argvars[1], NULL); } /* @@ -8623,7 +8623,7 @@ f_pathshorten(typval_T *argvars, typval_T *rettv) char_u *p; rettv->v_type = VAR_STRING; - p = get_tv_string_chk(&argvars[0]); + p = tv_get_string_chk(&argvars[0]); if (p == NULL) rettv->vval.v_string = NULL; else @@ -8645,7 +8645,7 @@ f_perleval(typval_T *argvars, typval_T *rettv) char_u *str; char_u buf[NUMBUFLEN]; - str = get_tv_string_buf(&argvars[0], buf); + str = tv_get_string_buf(&argvars[0], buf); do_perleval(str, rettv); } #endif @@ -8676,7 +8676,7 @@ f_prevnonblank(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - lnum = get_tv_lnum(argvars); + lnum = tv_get_lnum(argvars); if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) lnum = 0; else @@ -8708,7 +8708,7 @@ f_printf(typval_T *argvars, typval_T *rettv) /* Get the required length, allocate the buffer and do it for real. */ did_emsg = FALSE; - fmt = (char *)get_tv_string_buf(&argvars[0], buf); + fmt = (char *)tv_get_string_buf(&argvars[0], buf); len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); if (!did_emsg) { @@ -8797,7 +8797,7 @@ f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) if (buf == NULL) return; - text = get_tv_string(&argvars[1]); + text = tv_get_string(&argvars[1]); vim_free(buf->b_prompt_text); buf->b_prompt_text = vim_strsave(text); } @@ -8828,7 +8828,7 @@ f_py3eval(typval_T *argvars, typval_T *rettv) if (p_pyx == 0) p_pyx = 3; - str = get_tv_string_buf(&argvars[0], buf); + str = tv_get_string_buf(&argvars[0], buf); do_py3eval(str, rettv); } #endif @@ -8846,7 +8846,7 @@ f_pyeval(typval_T *argvars, typval_T *rettv) if (p_pyx == 0) p_pyx = 2; - str = get_tv_string_buf(&argvars[0], buf); + str = tv_get_string_buf(&argvars[0], buf); do_pyeval(str, rettv); } #endif @@ -8884,7 +8884,7 @@ f_range(typval_T *argvars, typval_T *rettv) varnumber_T i; int error = FALSE; - start = get_tv_number_chk(&argvars[0], &error); + start = tv_get_number_chk(&argvars[0], &error); if (argvars[1].v_type == VAR_UNKNOWN) { end = start - 1; @@ -8892,9 +8892,9 @@ f_range(typval_T *argvars, typval_T *rettv) } else { - end = get_tv_number_chk(&argvars[1], &error); + end = tv_get_number_chk(&argvars[1], &error); if (argvars[2].v_type != VAR_UNKNOWN) - stride = get_tv_number_chk(&argvars[2], &error); + stride = tv_get_number_chk(&argvars[2], &error); } if (error) @@ -8936,10 +8936,10 @@ f_readfile(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { - if (STRCMP(get_tv_string(&argvars[1]), "b") == 0) + if (STRCMP(tv_get_string(&argvars[1]), "b") == 0) binary = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) - maxline = (long)get_tv_number(&argvars[2]); + maxline = (long)tv_get_number(&argvars[2]); } if (rettv_list_alloc(rettv) == FAIL) @@ -8947,7 +8947,7 @@ f_readfile(typval_T *argvars, typval_T *rettv) /* Always open the file in binary mode, library functions have a mind of * their own about CR-LF conversion. */ - fname = get_tv_string(&argvars[0]); + fname = tv_get_string(&argvars[0]); if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) { EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") : fname); @@ -9318,12 +9318,12 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) # endif if (argvars[2].v_type != VAR_UNKNOWN && argvars[3].v_type != VAR_UNKNOWN) - timeout = get_tv_number(&argvars[3]); + timeout = tv_get_number(&argvars[3]); - server_name = get_tv_string_chk(&argvars[0]); + server_name = tv_get_string_chk(&argvars[0]); if (server_name == NULL) return; /* type error; errmsg already given */ - keys = get_tv_string_buf(&argvars[1], buf); + keys = tv_get_string_buf(&argvars[1], buf); # ifdef WIN32 if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) # else @@ -9349,7 +9349,7 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) char_u str[30]; char_u *idvar; - idvar = get_tv_string_chk(&argvars[2]); + idvar = tv_get_string_chk(&argvars[2]); if (idvar != NULL && *idvar != NUL) { sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); @@ -9385,7 +9385,7 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) # ifdef WIN32 /* On Win32 it's done in this application. */ { - char_u *server_name = get_tv_string_chk(&argvars[0]); + char_u *server_name = tv_get_string_chk(&argvars[0]); if (server_name != NULL) serverForeground(server_name); @@ -9419,7 +9419,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_number = -1; return; } - serverid = get_tv_string_chk(&argvars[0]); + serverid = tv_get_string_chk(&argvars[0]); if (serverid == NULL) { rettv->vval.v_number = -1; @@ -9448,7 +9448,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) v.di_tv.v_type = VAR_STRING; v.di_tv.vval.v_string = vim_strsave(s); - retvar = get_tv_string_chk(&argvars[1]); + retvar = tv_get_string_chk(&argvars[1]); if (retvar != NULL) set_var(retvar, &v.di_tv, FALSE); vim_free(v.di_tv.vval.v_string); @@ -9464,7 +9464,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) char_u *r = NULL; #ifdef FEAT_CLIENTSERVER - char_u *serverid = get_tv_string_chk(&argvars[0]); + char_u *serverid = tv_get_string_chk(&argvars[0]); if (serverid != NULL && !check_restricted() && !check_secure()) { @@ -9475,7 +9475,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) # endif if (argvars[1].v_type != VAR_UNKNOWN) - timeout = get_tv_number(&argvars[1]); + timeout = tv_get_number(&argvars[1]); # ifdef WIN32 sscanf((char *)serverid, SCANF_HEX_LONG_U, &n); @@ -9514,7 +9514,7 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_CLIENTSERVER - char_u *server = get_tv_string_chk(&argvars[0]); + char_u *server = tv_get_string_chk(&argvars[0]); if (server == NULL) return; /* type error; errmsg already given */ @@ -9557,7 +9557,7 @@ f_remove(typval_T *argvars, typval_T *rettv) else if ((d = argvars[0].vval.v_dict) != NULL && !tv_check_lock(d->dv_lock, arg_errmsg, TRUE)) { - key = get_tv_string_chk(&argvars[1]); + key = tv_get_string_chk(&argvars[1]); if (key != NULL) { di = dict_find(d, key, -1); @@ -9580,7 +9580,7 @@ f_remove(typval_T *argvars, typval_T *rettv) { int error = FALSE; - idx = (long)get_tv_number_chk(&argvars[1], &error); + idx = (long)tv_get_number_chk(&argvars[1], &error); if (error) ; /* type error: do nothing, errmsg already given */ else if ((item = list_find(l, idx)) == NULL) @@ -9597,7 +9597,7 @@ f_remove(typval_T *argvars, typval_T *rettv) else { /* Remove range of items, return list with values. */ - end = (long)get_tv_number_chk(&argvars[2], &error); + end = (long)tv_get_number_chk(&argvars[2], &error); if (error) ; /* type error: do nothing */ else if ((item2 = list_find(l, end)) == NULL) @@ -9644,8 +9644,8 @@ f_rename(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) rettv->vval.v_number = -1; else - rettv->vval.v_number = vim_rename(get_tv_string(&argvars[0]), - get_tv_string_buf(&argvars[1], buf)); + rettv->vval.v_number = vim_rename(tv_get_string(&argvars[0]), + tv_get_string_buf(&argvars[1], buf)); } /* @@ -9661,7 +9661,7 @@ f_repeat(typval_T *argvars, typval_T *rettv) char_u *r; int i; - n = (int)get_tv_number(&argvars[1]); + n = (int)tv_get_number(&argvars[1]); if (argvars[0].v_type == VAR_LIST) { if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) @@ -9672,7 +9672,7 @@ f_repeat(typval_T *argvars, typval_T *rettv) } else { - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -9704,7 +9704,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) char_u *buf = NULL; #endif - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); #ifdef FEAT_SHORTCUT { char_u *v = NULL; @@ -9950,7 +9950,7 @@ get_search_arg(typval_T *varp, int *flagsp) if (varp->v_type != VAR_UNKNOWN) { - flags = get_tv_string_buf_chk(varp, nbuf); + flags = tv_get_string_buf_chk(varp, nbuf); if (flags == NULL) return 0; /* type error; errmsg already given */ while (*flags != NUL) @@ -10010,7 +10010,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) int options = SEARCH_KEEP; int subpatnum; - pat = get_tv_string(&argvars[0]); + pat = tv_get_string(&argvars[0]); dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */ if (dir == 0) goto theend; @@ -10025,13 +10025,13 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) /* Optional arguments: line number to stop searching and timeout. */ if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) { - lnum_stop = (long)get_tv_number_chk(&argvars[2], NULL); + lnum_stop = (long)tv_get_number_chk(&argvars[2], NULL); if (lnum_stop < 0) goto theend; #ifdef FEAT_RELTIME if (argvars[3].v_type != VAR_UNKNOWN) { - time_limit = (long)get_tv_number_chk(&argvars[3], NULL); + time_limit = (long)tv_get_number_chk(&argvars[3], NULL); if (time_limit < 0) goto theend; } @@ -10052,7 +10052,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0) || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { - EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[1])); goto theend; } @@ -10127,8 +10127,8 @@ f_screenattr(typval_T *argvars, typval_T *rettv) int col; int c; - row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; - col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; + row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; + col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; @@ -10148,8 +10148,8 @@ f_screenchar(typval_T *argvars, typval_T *rettv) int off; int c; - row = (int)get_tv_number_chk(&argvars[0], NULL) - 1; - col = (int)get_tv_number_chk(&argvars[1], NULL) - 1; + row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; + col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) c = -1; @@ -10210,12 +10210,12 @@ f_searchdecl(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 1; /* default: FAIL */ - name = get_tv_string_chk(&argvars[0]); + name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - locally = (int)get_tv_number_chk(&argvars[1], &error) == 0; + locally = (int)tv_get_number_chk(&argvars[1], &error) == 0; if (!error && argvars[2].v_type != VAR_UNKNOWN) - thisblock = (int)get_tv_number_chk(&argvars[2], &error) != 0; + thisblock = (int)tv_get_number_chk(&argvars[2], &error) != 0; } if (!error && name != NULL) rettv->vval.v_number = find_decl(name, (int)STRLEN(name), @@ -10241,9 +10241,9 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) /* Get the three pattern arguments: start, middle, end. Will result in an * error if not a valid argument. */ - spat = get_tv_string_chk(&argvars[0]); - mpat = get_tv_string_buf_chk(&argvars[1], nbuf1); - epat = get_tv_string_buf_chk(&argvars[2], nbuf2); + spat = tv_get_string_chk(&argvars[0]); + mpat = tv_get_string_buf_chk(&argvars[1], nbuf1); + epat = tv_get_string_buf_chk(&argvars[2], nbuf2); if (spat == NULL || mpat == NULL || epat == NULL) goto theend; /* type error */ @@ -10258,7 +10258,7 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) if ((flags & (SP_END | SP_SUBPAT)) != 0 || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { - EMSG2(_(e_invarg2), get_tv_string(&argvars[3])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[3])); goto theend; } @@ -10277,24 +10277,24 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) && skip->v_type != VAR_STRING) { /* Type error */ - EMSG2(_(e_invarg2), get_tv_string(&argvars[4])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[4])); goto theend; } if (argvars[5].v_type != VAR_UNKNOWN) { - lnum_stop = (long)get_tv_number_chk(&argvars[5], NULL); + lnum_stop = (long)tv_get_number_chk(&argvars[5], NULL); if (lnum_stop < 0) { - EMSG2(_(e_invarg2), get_tv_string(&argvars[5])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[5])); goto theend; } #ifdef FEAT_RELTIME if (argvars[6].v_type != VAR_UNKNOWN) { - time_limit = (long)get_tv_number_chk(&argvars[6], NULL); + time_limit = (long)tv_get_number_chk(&argvars[6], NULL); if (time_limit < 0) { - EMSG2(_(e_invarg2), get_tv_string(&argvars[6])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[6])); goto theend; } } @@ -10544,8 +10544,8 @@ f_server2client(typval_T *argvars UNUSED, typval_T *rettv) { #ifdef FEAT_CLIENTSERVER char_u buf[NUMBUFLEN]; - char_u *server = get_tv_string_chk(&argvars[0]); - char_u *reply = get_tv_string_buf_chk(&argvars[1], buf); + char_u *server = tv_get_string_chk(&argvars[0]); + char_u *reply = tv_get_string_buf_chk(&argvars[1], buf); rettv->vval.v_number = -1; if (server == NULL || reply == NULL) @@ -10600,7 +10600,7 @@ f_setbufline(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 1; /* FAIL */ else { - lnum = get_tv_lnum_buf(&argvars[1], buf); + lnum = tv_get_lnum_buf(&argvars[1], buf); set_buffer_lines(buf, lnum, FALSE, &argvars[2], rettv); } } @@ -10618,8 +10618,8 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) if (check_restricted() || check_secure()) return; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ - varname = get_tv_string_chk(&argvars[1]); + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ + varname = tv_get_string_chk(&argvars[1]); buf = get_buf_tv(&argvars[0], FALSE); varp = &argvars[2]; @@ -10636,8 +10636,8 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) aucmd_prepbuf(&aco, buf); ++varname; - numval = (long)get_tv_number_chk(varp, &error); - strval = get_tv_string_buf_chk(varp, nbuf); + numval = (long)tv_get_number_chk(varp, &error); + strval = tv_get_string_buf_chk(varp, nbuf); if (!error && strval != NULL) set_option_value(varname, numval, strval, OPT_LOCAL); @@ -10696,12 +10696,12 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED) di = dict_find(d, (char_u *)"forward", -1); if (di != NULL) - set_csearch_direction((int)get_tv_number(&di->di_tv) + set_csearch_direction((int)tv_get_number(&di->di_tv) ? FORWARD : BACKWARD); di = dict_find(d, (char_u *)"until", -1); if (di != NULL) - set_csearch_until(!!get_tv_number(&di->di_tv)); + set_csearch_until(!!tv_get_number(&di->di_tv)); } } @@ -10711,7 +10711,7 @@ f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED) static void f_setcmdpos(typval_T *argvars, typval_T *rettv) { - int pos = (int)get_tv_number(&argvars[0]) - 1; + int pos = (int)tv_get_number(&argvars[0]) - 1; if (pos >= 0) rettv->vval.v_number = set_cmdline_pos(pos); @@ -10731,10 +10731,10 @@ f_setfperm(typval_T *argvars, typval_T *rettv) int mode = 0; rettv->vval.v_number = 0; - fname = get_tv_string_chk(&argvars[0]); + fname = tv_get_string_chk(&argvars[0]); if (fname == NULL) return; - mode_str = get_tv_string_buf_chk(&argvars[1], modebuf); + mode_str = tv_get_string_buf_chk(&argvars[1], modebuf); if (mode_str == NULL) return; if (STRLEN(mode_str) != 9) @@ -10759,7 +10759,7 @@ f_setfperm(typval_T *argvars, typval_T *rettv) static void f_setline(typval_T *argvars, typval_T *rettv) { - linenr_T lnum = get_tv_lnum(&argvars[0]); + linenr_T lnum = tv_get_lnum(&argvars[0]); set_buffer_lines(curbuf, lnum, FALSE, &argvars[1], rettv); } @@ -10797,7 +10797,7 @@ set_qf_ll_list( if (action_arg->v_type == VAR_STRING) { - act = get_tv_string_chk(action_arg); + act = tv_get_string_chk(action_arg); if (act == NULL) return; /* type error; errmsg already given */ if ((*act == 'a' || *act == 'r' || *act == ' ' || *act == 'f') && @@ -10971,7 +10971,7 @@ f_setpos(typval_T *argvars, typval_T *rettv) colnr_T curswant = -1; rettv->vval.v_number = -1; - name = get_tv_string_chk(argvars); + name = tv_get_string_chk(argvars); if (name != NULL) { if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) @@ -11029,7 +11029,7 @@ f_setreg(typval_T *argvars, typval_T *rettv) yank_type = MAUTO; append = FALSE; - strregname = get_tv_string_chk(argvars); + strregname = tv_get_string_chk(argvars); rettv->vval.v_number = 1; /* FAIL is default */ if (strregname == NULL) @@ -11040,7 +11040,7 @@ f_setreg(typval_T *argvars, typval_T *rettv) if (argvars[2].v_type != VAR_UNKNOWN) { - stropt = get_tv_string_chk(&argvars[2]); + stropt = tv_get_string_chk(&argvars[2]); if (stropt == NULL) return; /* type error */ for (; *stropt != NUL; ++stropt) @@ -11093,12 +11093,12 @@ f_setreg(typval_T *argvars, typval_T *rettv) for (li = ll == NULL ? NULL : ll->lv_first; li != NULL; li = li->li_next) { - strval = get_tv_string_buf_chk(&li->li_tv, buf); + strval = tv_get_string_buf_chk(&li->li_tv, buf); if (strval == NULL) goto free_lstval; if (strval == buf) { - /* Need to make a copy, next get_tv_string_buf_chk() will + /* Need to make a copy, next tv_get_string_buf_chk() will * overwrite the string. */ strval = vim_strsave(buf); if (strval == NULL) @@ -11118,7 +11118,7 @@ free_lstval: } else { - strval = get_tv_string_chk(&argvars[1]); + strval = tv_get_string_chk(&argvars[1]); if (strval == NULL) return; write_reg_contents_ex(regname, strval, -1, @@ -11143,8 +11143,8 @@ f_settabvar(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); - varname = get_tv_string_chk(&argvars[1]); + tp = find_tabpage((int)tv_get_number_chk(&argvars[0], NULL)); + varname = tv_get_string_chk(&argvars[1]); varp = &argvars[2]; if (varname != NULL && varp != NULL && tp != NULL) @@ -11211,7 +11211,7 @@ f_settagstack(typval_T *argvars, typval_T *rettv) else if (argvars[2].v_type == VAR_STRING) { char_u *actstr; - actstr = get_tv_string_chk(&argvars[2]); + actstr = tv_get_string_chk(&argvars[2]); if (actstr == NULL) return; if ((*actstr == 'r' || *actstr == 'a') && actstr[1] == NUL) @@ -11250,7 +11250,7 @@ f_sha256(typval_T *argvars, typval_T *rettv) { char_u *p; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); rettv->vval.v_string = vim_strsave( sha256_bytes(p, (int)STRLEN(p), NULL, 0)); rettv->v_type = VAR_STRING; @@ -11266,7 +11266,7 @@ f_shellescape(typval_T *argvars, typval_T *rettv) int do_special = non_zero_arg(&argvars[1]); rettv->vval.v_string = vim_strsave_shellescape( - get_tv_string(&argvars[0]), do_special, do_special); + tv_get_string(&argvars[0]), do_special, do_special); rettv->v_type = VAR_STRING; } @@ -11282,7 +11282,7 @@ f_shiftwidth(typval_T *argvars UNUSED, typval_T *rettv) { long col; - col = (long)get_tv_number_chk(argvars, NULL); + col = (long)tv_get_number_chk(argvars, NULL); if (col < 0) return; // type error; errmsg already given #ifdef FEAT_VARTABS @@ -11310,7 +11310,7 @@ f_sign_define(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - name = get_tv_string_chk(&argvars[0]); + name = tv_get_string_chk(&argvars[0]); if (name == NULL) return; @@ -11355,7 +11355,7 @@ f_sign_getdefined(typval_T *argvars, typval_T *rettv) return; if (argvars[0].v_type != VAR_UNKNOWN) - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); sign_getlist(name, rettv->vval.v_list); } @@ -11384,7 +11384,7 @@ f_sign_getplaced(typval_T *argvars, typval_T *rettv) if (buf == NULL) { EMSG2(_("E158: Invalid buffer name: %s"), - get_tv_string(&argvars[0])); + tv_get_string(&argvars[0])); return; } @@ -11399,21 +11399,21 @@ f_sign_getplaced(typval_T *argvars, typval_T *rettv) if ((di = dict_find(dict, (char_u *)"lnum", -1)) != NULL) { // get signs placed at this line - (void)get_tv_number_chk(&di->di_tv, ¬anum); + (void)tv_get_number_chk(&di->di_tv, ¬anum); if (notanum) return; - lnum = get_tv_lnum(&di->di_tv); + lnum = tv_get_lnum(&di->di_tv); } if ((di = dict_find(dict, (char_u *)"id", -1)) != NULL) { // get sign placed with this identifier - sign_id = (int)get_tv_number_chk(&di->di_tv, ¬anum); + sign_id = (int)tv_get_number_chk(&di->di_tv, ¬anum); if (notanum) return; } if ((di = dict_find(dict, (char_u *)"group", -1)) != NULL) { - group = get_tv_string_chk(&di->di_tv); + group = tv_get_string_chk(&di->di_tv); if (group == NULL) return; } @@ -11442,7 +11442,7 @@ f_sign_place(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; // Sign identifer - sign_id = (int)get_tv_number_chk(&argvars[0], ¬anum); + sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum); if (notanum) return; if (sign_id < 0) @@ -11452,7 +11452,7 @@ f_sign_place(typval_T *argvars, typval_T *rettv) } // Sign group - group = get_tv_string_chk(&argvars[1]); + group = tv_get_string_chk(&argvars[1]); if (group == NULL) return; if (group[0] == '\0') @@ -11465,7 +11465,7 @@ f_sign_place(typval_T *argvars, typval_T *rettv) } // Sign name - sign_name = get_tv_string_chk(&argvars[2]); + sign_name = tv_get_string_chk(&argvars[2]); if (sign_name == NULL) goto cleanup; @@ -11473,7 +11473,7 @@ f_sign_place(typval_T *argvars, typval_T *rettv) buf = find_buffer(&argvars[3]); if (buf == NULL) { - EMSG2(_("E158: Invalid buffer name: %s"), get_tv_string(&argvars[2])); + EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(&argvars[2])); goto cleanup; } @@ -11489,15 +11489,15 @@ f_sign_place(typval_T *argvars, typval_T *rettv) // Line number where the sign is to be placed if ((di = dict_find(dict, (char_u *)"lnum", -1)) != NULL) { - (void)get_tv_number_chk(&di->di_tv, ¬anum); + (void)tv_get_number_chk(&di->di_tv, ¬anum); if (notanum) goto cleanup; - lnum = get_tv_lnum(&di->di_tv); + lnum = tv_get_lnum(&di->di_tv); } if ((di = dict_find(dict, (char_u *)"priority", -1)) != NULL) { // Sign priority - prio = (int)get_tv_number_chk(&di->di_tv, ¬anum); + prio = (int)tv_get_number_chk(&di->di_tv, ¬anum); if (notanum) goto cleanup; } @@ -11529,7 +11529,7 @@ f_sign_undefine(typval_T *argvars, typval_T *rettv) else { // Free only the specified sign - name = get_tv_string_chk(&argvars[0]); + name = tv_get_string_chk(&argvars[0]); if (name == NULL) return; @@ -11558,7 +11558,7 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv) return; } - group = get_tv_string(&argvars[0]); + group = tv_get_string(&argvars[0]); if (group[0] == '\0') group = NULL; // global sign group else @@ -11583,7 +11583,7 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv) if (buf == NULL) { EMSG2(_("E158: Invalid buffer name: %s"), - get_tv_string(&di->di_tv)); + tv_get_string(&di->di_tv)); return; } } @@ -11615,7 +11615,7 @@ f_simplify(typval_T *argvars, typval_T *rettv) { char_u *p; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); rettv->vval.v_string = vim_strsave(p); simplify_filename(rettv->vval.v_string); /* simplify in place */ rettv->v_type = VAR_STRING; @@ -11713,8 +11713,8 @@ item_compare(const void *s1, const void *s2) if (sortinfo->item_compare_numbers) { - varnumber_T v1 = get_tv_number(tv1); - varnumber_T v2 = get_tv_number(tv2); + varnumber_T v1 = tv_get_number(tv1); + varnumber_T v2 = tv_get_number(tv2); return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } @@ -11722,8 +11722,8 @@ item_compare(const void *s1, const void *s2) #ifdef FEAT_FLOAT if (sortinfo->item_compare_float) { - float_T v1 = get_tv_float(tv1); - float_T v2 = get_tv_float(tv2); + float_T v1 = tv_get_float(tv1); + float_T v2 = tv_get_float(tv2); return v1 == v2 ? 0 : v1 > v2 ? 1 : -1; } @@ -11820,7 +11820,7 @@ item_compare2(const void *s1, const void *s2) if (res == FAIL) res = ITEM_COMPARE_FAIL; else - res = (int)get_tv_number_chk(&rettv, &sortinfo->item_compare_func_err); + res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err); if (sortinfo->item_compare_func_err) res = ITEM_COMPARE_FAIL; /* return value has wrong type */ clear_tv(&rettv); @@ -11887,13 +11887,13 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort) { int error = FALSE; - i = (long)get_tv_number_chk(&argvars[1], &error); + i = (long)tv_get_number_chk(&argvars[1], &error); if (error) goto theend; /* type error; errmsg already given */ if (i == 1) info.item_compare_ic = TRUE; else if (argvars[1].v_type != VAR_NUMBER) - info.item_compare_func = get_tv_string(&argvars[1]); + info.item_compare_func = tv_get_string(&argvars[1]); else if (i != 0) { EMSG(_(e_invarg)); @@ -12059,7 +12059,7 @@ f_soundfold(typval_T *argvars, typval_T *rettv) char_u *s; rettv->v_type = VAR_STRING; - s = get_tv_string(&argvars[0]); + s = tv_get_string(&argvars[0]); #ifdef FEAT_SPELL rettv->vval.v_string = eval_soundfold(s); #else @@ -12093,7 +12093,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv) } else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) { - char_u *str = get_tv_string_chk(&argvars[0]); + char_u *str = tv_get_string_chk(&argvars[0]); int capcol = -1; if (str != NULL) @@ -12145,15 +12145,15 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv) #ifdef FEAT_SPELL if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) { - str = get_tv_string(&argvars[0]); + str = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - maxcount = (int)get_tv_number_chk(&argvars[1], &typeerr); + maxcount = (int)tv_get_number_chk(&argvars[1], &typeerr); if (maxcount <= 0) return; if (argvars[2].v_type != VAR_UNKNOWN) { - need_capital = (int)get_tv_number_chk(&argvars[2], &typeerr); + need_capital = (int)tv_get_number_chk(&argvars[2], &typeerr); if (typeerr) return; } @@ -12201,14 +12201,14 @@ f_split(typval_T *argvars, typval_T *rettv) save_cpo = p_cpo; p_cpo = (char_u *)""; - str = get_tv_string(&argvars[0]); + str = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { - pat = get_tv_string_buf_chk(&argvars[1], patbuf); + pat = tv_get_string_buf_chk(&argvars[1], patbuf); if (pat == NULL) typeerr = TRUE; if (argvars[2].v_type != VAR_UNKNOWN) - keepempty = (int)get_tv_number_chk(&argvars[2], &typeerr); + keepempty = (int)tv_get_number_chk(&argvars[2], &typeerr); } if (pat == NULL || *pat == NUL) pat = (char_u *)"[\\x01- ]\\+"; @@ -12284,7 +12284,7 @@ f_sqrt(typval_T *argvars, typval_T *rettv) static void f_str2float(typval_T *argvars, typval_T *rettv) { - char_u *p = skipwhite(get_tv_string(&argvars[0])); + char_u *p = skipwhite(tv_get_string(&argvars[0])); int isneg = (*p == '-'); if (*p == '+' || *p == '-') @@ -12310,7 +12310,7 @@ f_str2nr(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { - base = (int)get_tv_number(&argvars[1]); + base = (int)tv_get_number(&argvars[1]); if (base != 2 && base != 8 && base != 10 && base != 16) { EMSG(_(e_invarg)); @@ -12318,7 +12318,7 @@ f_str2nr(typval_T *argvars, typval_T *rettv) } } - p = skipwhite(get_tv_string(&argvars[0])); + p = skipwhite(tv_get_string(&argvars[0])); isneg = (*p == '-'); if (*p == '+' || *p == '-') p = skipwhite(p + 1); @@ -12351,11 +12351,11 @@ f_strftime(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); if (argvars[1].v_type == VAR_UNKNOWN) seconds = time(NULL); else - seconds = (time_t)get_tv_number(&argvars[1]); + seconds = (time_t)tv_get_number(&argvars[1]); curtime = localtime(&seconds); /* MSVC returns NULL for an invalid value of seconds. */ if (curtime == NULL) @@ -12409,11 +12409,11 @@ f_strgetchar(typval_T *argvars, typval_T *rettv) int charidx; rettv->vval.v_number = -1; - str = get_tv_string_chk(&argvars[0]); + str = tv_get_string_chk(&argvars[0]); if (str == NULL) return; len = (int)STRLEN(str); - charidx = (int)get_tv_number_chk(&argvars[1], &error); + charidx = (int)tv_get_number_chk(&argvars[1], &error); if (error) return; #ifdef FEAT_MBYTE @@ -12450,8 +12450,8 @@ f_stridx(typval_T *argvars, typval_T *rettv) char_u *pos; int start_idx; - needle = get_tv_string_chk(&argvars[1]); - save_haystack = haystack = get_tv_string_buf_chk(&argvars[0], buf); + needle = tv_get_string_chk(&argvars[1]); + save_haystack = haystack = tv_get_string_buf_chk(&argvars[0], buf); rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) return; /* type error; errmsg already given */ @@ -12460,7 +12460,7 @@ f_stridx(typval_T *argvars, typval_T *rettv) { int error = FALSE; - start_idx = (int)get_tv_number_chk(&argvars[2], &error); + start_idx = (int)tv_get_number_chk(&argvars[2], &error); if (error || start_idx >= (int)STRLEN(haystack)) return; if (start_idx >= 0) @@ -12496,7 +12496,7 @@ f_string(typval_T *argvars, typval_T *rettv) f_strlen(typval_T *argvars, typval_T *rettv) { rettv->vval.v_number = (varnumber_T)(STRLEN( - get_tv_string(&argvars[0]))); + tv_get_string(&argvars[0]))); } /* @@ -12505,7 +12505,7 @@ f_strlen(typval_T *argvars, typval_T *rettv) static void f_strchars(typval_T *argvars, typval_T *rettv) { - char_u *s = get_tv_string(&argvars[0]); + char_u *s = tv_get_string(&argvars[0]); int skipcc = 0; #ifdef FEAT_MBYTE varnumber_T len = 0; @@ -12513,7 +12513,7 @@ f_strchars(typval_T *argvars, typval_T *rettv) #endif if (argvars[1].v_type != VAR_UNKNOWN) - skipcc = (int)get_tv_number_chk(&argvars[1], NULL); + skipcc = (int)tv_get_number_chk(&argvars[1], NULL); if (skipcc < 0 || skipcc > 1) EMSG(_(e_invarg)); else @@ -12538,11 +12538,11 @@ f_strchars(typval_T *argvars, typval_T *rettv) static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv) { - char_u *s = get_tv_string(&argvars[0]); + char_u *s = tv_get_string(&argvars[0]); int col = 0; if (argvars[1].v_type != VAR_UNKNOWN) - col = (int)get_tv_number(&argvars[1]); + col = (int)tv_get_number(&argvars[1]); rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); } @@ -12553,7 +12553,7 @@ f_strdisplaywidth(typval_T *argvars, typval_T *rettv) static void f_strwidth(typval_T *argvars, typval_T *rettv) { - char_u *s = get_tv_string(&argvars[0]); + char_u *s = tv_get_string(&argvars[0]); rettv->vval.v_number = (varnumber_T)( #ifdef FEAT_MBYTE @@ -12579,10 +12579,10 @@ f_strcharpart(typval_T *argvars, typval_T *rettv) int slen; int error = FALSE; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); slen = (int)STRLEN(p); - nchar = (int)get_tv_number_chk(&argvars[1], &error); + nchar = (int)tv_get_number_chk(&argvars[1], &error); if (!error) { if (nchar > 0) @@ -12595,7 +12595,7 @@ f_strcharpart(typval_T *argvars, typval_T *rettv) nbyte = nchar; if (argvars[2].v_type != VAR_UNKNOWN) { - charlen = (int)get_tv_number(&argvars[2]); + charlen = (int)tv_get_number(&argvars[2]); while (charlen > 0 && nbyte + len < slen) { int off = nbyte + len; @@ -12646,14 +12646,14 @@ f_strpart(typval_T *argvars, typval_T *rettv) int slen; int error = FALSE; - p = get_tv_string(&argvars[0]); + p = tv_get_string(&argvars[0]); slen = (int)STRLEN(p); - n = (int)get_tv_number_chk(&argvars[1], &error); + n = (int)tv_get_number_chk(&argvars[1], &error); if (error) len = 0; else if (argvars[2].v_type != VAR_UNKNOWN) - len = (int)get_tv_number(&argvars[2]); + len = (int)tv_get_number(&argvars[2]); else len = slen - n; /* default len: all bytes that are available. */ @@ -12690,8 +12690,8 @@ f_strridx(typval_T *argvars, typval_T *rettv) char_u *lastmatch = NULL; int haystack_len, end_idx; - needle = get_tv_string_chk(&argvars[1]); - haystack = get_tv_string_buf_chk(&argvars[0], buf); + needle = tv_get_string_chk(&argvars[1]); + haystack = tv_get_string_buf_chk(&argvars[0], buf); rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) @@ -12701,7 +12701,7 @@ f_strridx(typval_T *argvars, typval_T *rettv) if (argvars[2].v_type != VAR_UNKNOWN) { /* Third argument: upper limit for index */ - end_idx = (int)get_tv_number_chk(&argvars[2], NULL); + end_idx = (int)tv_get_number_chk(&argvars[2], NULL); if (end_idx < 0) return; /* can never find a match */ } @@ -12737,7 +12737,7 @@ f_strridx(typval_T *argvars, typval_T *rettv) f_strtrans(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = transstr(get_tv_string(&argvars[0])); + rettv->vval.v_string = transstr(tv_get_string(&argvars[0])); } /* @@ -12750,7 +12750,7 @@ f_submatch(typval_T *argvars, typval_T *rettv) int no; int retList = 0; - no = (int)get_tv_number_chk(&argvars[0], &error); + no = (int)tv_get_number_chk(&argvars[0], &error); if (error) return; if (no < 0 || no >= NSUBEXP) @@ -12759,7 +12759,7 @@ f_submatch(typval_T *argvars, typval_T *rettv) return; } if (argvars[1].v_type != VAR_UNKNOWN) - retList = (int)get_tv_number_chk(&argvars[1], &error); + retList = (int)tv_get_number_chk(&argvars[1], &error); if (error) return; @@ -12785,16 +12785,16 @@ f_substitute(typval_T *argvars, typval_T *rettv) char_u subbuf[NUMBUFLEN]; char_u flagsbuf[NUMBUFLEN]; - char_u *str = get_tv_string_chk(&argvars[0]); - char_u *pat = get_tv_string_buf_chk(&argvars[1], patbuf); + char_u *str = tv_get_string_chk(&argvars[0]); + char_u *pat = tv_get_string_buf_chk(&argvars[1], patbuf); char_u *sub = NULL; typval_T *expr = NULL; - char_u *flg = get_tv_string_buf_chk(&argvars[3], flagsbuf); + char_u *flg = tv_get_string_buf_chk(&argvars[3], flagsbuf); if (argvars[2].v_type == VAR_FUNC || argvars[2].v_type == VAR_PARTIAL) expr = &argvars[2]; else - sub = get_tv_string_buf_chk(&argvars[2], subbuf); + sub = tv_get_string_buf_chk(&argvars[2], subbuf); rettv->v_type = VAR_STRING; if (str == NULL || pat == NULL || (sub == NULL && expr == NULL) @@ -12811,7 +12811,7 @@ f_substitute(typval_T *argvars, typval_T *rettv) f_swapinfo(typval_T *argvars, typval_T *rettv) { if (rettv_dict_alloc(rettv) == OK) - get_b0_dict(get_tv_string(argvars), rettv->vval.v_dict); + get_b0_dict(tv_get_string(argvars), rettv->vval.v_dict); } /* @@ -12844,9 +12844,9 @@ f_synID(typval_T *argvars UNUSED, typval_T *rettv) int trans; int transerr = FALSE; - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = (linenr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ - trans = (int)get_tv_number_chk(&argvars[2], &transerr); + lnum = tv_get_lnum(argvars); /* -1 on type error */ + col = (linenr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ + trans = (int)tv_get_number_chk(&argvars[2], &transerr); if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col < (long)STRLEN(ml_get(lnum))) @@ -12870,11 +12870,11 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) char_u modebuf[NUMBUFLEN]; int modec; - id = (int)get_tv_number(&argvars[0]); - what = get_tv_string(&argvars[1]); + id = (int)tv_get_number(&argvars[0]); + what = tv_get_string(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) { - mode = get_tv_string_buf(&argvars[2], modebuf); + mode = tv_get_string_buf(&argvars[2], modebuf); modec = TOLOWER_ASC(mode[0]); if (modec != 't' && modec != 'c' && modec != 'g') modec = 0; /* replace invalid with current */ @@ -12957,7 +12957,7 @@ f_synIDtrans(typval_T *argvars UNUSED, typval_T *rettv) int id; #ifdef FEAT_SYN_HL - id = (int)get_tv_number(&argvars[0]); + id = (int)tv_get_number(&argvars[0]); if (id > 0) id = syn_get_final_id(id); @@ -12986,8 +12986,8 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) rettv_list_set(rettv, NULL); #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ + lnum = tv_get_lnum(argvars); /* -1 on type error */ + col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ vim_memset(str, NUL, sizeof(str)); @@ -13043,8 +13043,8 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv) rettv_list_set(rettv, NULL); #ifdef FEAT_SYN_HL - lnum = get_tv_lnum(argvars); /* -1 on type error */ - col = (colnr_T)get_tv_number(&argvars[1]) - 1; /* -1 on type error */ + lnum = tv_get_lnum(argvars); /* -1 on type error */ + col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) @@ -13138,7 +13138,7 @@ get_cmd_output_as_rettv( size_t len; char_u buf[NUMBUFLEN]; - p = get_tv_string_buf_chk(&argvars[1], buf); + p = tv_get_string_buf_chk(&argvars[1], buf); if (p == NULL) { fclose(fd); @@ -13171,7 +13171,7 @@ get_cmd_output_as_rettv( char_u *end; int i; - res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, &len); + res = get_cmd_output(tv_get_string(&argvars[0]), infile, flags, &len); if (res == NULL) goto errret; @@ -13211,7 +13211,7 @@ get_cmd_output_as_rettv( } else { - res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, NULL); + res = get_cmd_output(tv_get_string(&argvars[0]), infile, flags, NULL); #ifdef USE_CR /* translate <CR> into <NL> */ if (res != NULL) @@ -13289,7 +13289,7 @@ f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) wp = firstwin; else { - tp = find_tabpage((int)get_tv_number(&argvars[0])); + tp = find_tabpage((int)tv_get_number(&argvars[0])); if (tp != NULL) wp = (tp == curtab) ? firstwin : tp->tp_firstwin; } @@ -13313,7 +13313,7 @@ f_tabpagenr(typval_T *argvars UNUSED, typval_T *rettv) if (argvars[0].v_type != VAR_UNKNOWN) { - arg = get_tv_string_chk(&argvars[0]); + arg = tv_get_string_chk(&argvars[0]); nr = 0; if (arg != NULL) { @@ -13343,7 +13343,7 @@ get_winnr(tabpage_T *tp, typval_T *argvar) twin = (tp == curtab) ? curwin : tp->tp_curwin; if (argvar->v_type != VAR_UNKNOWN) { - arg = get_tv_string_chk(argvar); + arg = tv_get_string_chk(argvar); if (arg == NULL) nr = 0; /* type error; errmsg already given */ else if (STRCMP(arg, "$") == 0) @@ -13385,7 +13385,7 @@ f_tabpagewinnr(typval_T *argvars UNUSED, typval_T *rettv) int nr = 1; tabpage_T *tp; - tp = find_tabpage((int)get_tv_number(&argvars[0])); + tp = find_tabpage((int)tv_get_number(&argvars[0])); if (tp == NULL) nr = 0; else @@ -13426,14 +13426,14 @@ f_taglist(typval_T *argvars, typval_T *rettv) char_u *fname = NULL; char_u *tag_pattern; - tag_pattern = get_tv_string(&argvars[0]); + tag_pattern = tv_get_string(&argvars[0]); rettv->vval.v_number = FALSE; if (*tag_pattern == NUL) return; if (argvars[1].v_type != VAR_UNKNOWN) - fname = get_tv_string(&argvars[1]); + fname = tv_get_string(&argvars[1]); if (rettv_list_alloc(rettv) == OK) (void)get_tags(rettv->vval.v_list, tag_pattern, fname); } @@ -13544,7 +13544,7 @@ f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_test_feedinput(typval_T *argvars, typval_T *rettv UNUSED) { #ifdef USE_INPUT_BUF - char_u *val = get_tv_string_chk(&argvars[0]); + char_u *val = tv_get_string_chk(&argvars[0]); if (val != NULL) { @@ -13566,7 +13566,7 @@ f_test_option_not_set(typval_T *argvars, typval_T *rettv UNUSED) EMSG(_(e_invarg)); else { - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (reset_option_was_set(name) == FAIL) EMSG2(_(e_invarg2), name); } @@ -13587,8 +13587,8 @@ f_test_override(typval_T *argvars, typval_T *rettv UNUSED) EMSG(_(e_invarg)); else { - name = get_tv_string_chk(&argvars[0]); - val = (int)get_tv_number(&argvars[1]); + name = tv_get_string_chk(&argvars[0]); + val = (int)tv_get_number(&argvars[1]); if (STRCMP(name, (char_u *)"redraw") == 0) disable_redraw_for_testing = val; @@ -13646,7 +13646,7 @@ f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) static void f_test_ignore_error(typval_T *argvars, typval_T *rettv UNUSED) { - ignore_error_for_testing(get_tv_string(&argvars[0])); + ignore_error_for_testing(tv_get_string(&argvars[0])); } #ifdef FEAT_JOB_CHANNEL @@ -13709,9 +13709,9 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED) EMSG(_(e_invarg)); return; } - which = get_tv_string(&argvars[0]); - value = get_tv_number(&argvars[1]); - dragging = get_tv_number(&argvars[2]); + which = tv_get_string(&argvars[0]); + value = tv_get_number(&argvars[1]); + dragging = tv_get_number(&argvars[2]); if (STRCMP(which, "left") == 0) sb = &curwin->w_scrollbars[SBAR_LEFT]; @@ -13735,7 +13735,7 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED) static void f_test_settime(typval_T *argvars, typval_T *rettv UNUSED) { - time_for_testing = (time_t)get_tv_number(&argvars[0]); + time_for_testing = (time_t)tv_get_number(&argvars[0]); } #if defined(FEAT_JOB_CHANNEL) || defined(FEAT_TIMERS) || defined(PROTO) @@ -13798,7 +13798,7 @@ f_timer_info(typval_T *argvars, typval_T *rettv) EMSG(_(e_number_exp)); else { - timer = find_timer((int)get_tv_number(&argvars[0])); + timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) add_timer_info(rettv, timer); } @@ -13814,13 +13814,13 @@ f_timer_info(typval_T *argvars, typval_T *rettv) f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) { timer_T *timer = NULL; - int paused = (int)get_tv_number(&argvars[1]); + int paused = (int)tv_get_number(&argvars[1]); if (argvars[0].v_type != VAR_NUMBER) EMSG(_(e_number_exp)); else { - timer = find_timer((int)get_tv_number(&argvars[0])); + timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) timer->tr_paused = paused; } @@ -13832,7 +13832,7 @@ f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED) static void f_timer_start(typval_T *argvars, typval_T *rettv) { - long msec = (long)get_tv_number(&argvars[0]); + long msec = (long)tv_get_number(&argvars[0]); timer_T *timer; int repeat = 0; char_u *callback; @@ -13847,7 +13847,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv) if (argvars[2].v_type != VAR_DICT || (dict = argvars[2].vval.v_dict) == NULL) { - EMSG2(_(e_invarg2), get_tv_string(&argvars[2])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[2])); return; } if (dict_find(dict, (char_u *)"repeat", -1) != NULL) @@ -13886,7 +13886,7 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED) EMSG(_(e_number_exp)); return; } - timer = find_timer((int)get_tv_number(&argvars[0])); + timer = find_timer((int)tv_get_number(&argvars[0])); if (timer != NULL) stop_timer(timer); } @@ -13908,7 +13908,7 @@ f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_tolower(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = strlow_save(get_tv_string(&argvars[0])); + rettv->vval.v_string = strlow_save(tv_get_string(&argvars[0])); } /* @@ -13918,7 +13918,7 @@ f_tolower(typval_T *argvars, typval_T *rettv) f_toupper(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = strup_save(get_tv_string(&argvars[0])); + rettv->vval.v_string = strup_save(tv_get_string(&argvars[0])); } /* @@ -13944,9 +13944,9 @@ f_tr(typval_T *argvars, typval_T *rettv) char_u buf2[NUMBUFLEN]; garray_T ga; - in_str = get_tv_string(&argvars[0]); - fromstr = get_tv_string_buf_chk(&argvars[1], buf); - tostr = get_tv_string_buf_chk(&argvars[2], buf2); + in_str = tv_get_string(&argvars[0]); + fromstr = tv_get_string_buf_chk(&argvars[1], buf); + tostr = tv_get_string_buf_chk(&argvars[2], buf2); /* Default return value: empty string. */ rettv->v_type = VAR_STRING; @@ -14050,7 +14050,7 @@ f_trim(typval_T *argvars, typval_T *rettv) { char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; - char_u *head = get_tv_string_buf_chk(&argvars[0], buf1); + char_u *head = tv_get_string_buf_chk(&argvars[0], buf1); char_u *mask = NULL; char_u *tail; char_u *prev; @@ -14065,7 +14065,7 @@ f_trim(typval_T *argvars, typval_T *rettv) } if (argvars[1].v_type == VAR_STRING) - mask = get_tv_string_buf_chk(&argvars[1], buf2); + mask = tv_get_string_buf_chk(&argvars[1], buf2); while (*head != NUL) { @@ -14169,7 +14169,7 @@ f_undofile(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; #ifdef FEAT_PERSISTENT_UNDO { - char_u *fname = get_tv_string(&argvars[0]); + char_u *fname = tv_get_string(&argvars[0]); if (*fname == NUL) { @@ -14332,7 +14332,7 @@ f_winlayout(typval_T *argvars, typval_T *rettv) tp = curtab; else { - tp = find_tabpage((int)get_tv_number(&argvars[0])); + tp = find_tabpage((int)tv_get_number(&argvars[0])); if (tp == NULL) return; } @@ -14525,12 +14525,12 @@ f_writefile(typval_T *argvars, typval_T *rettv) if (list == NULL) return; for (li = list->lv_first; li != NULL; li = li->li_next) - if (get_tv_string_chk(&li->li_tv) == NULL) + if (tv_get_string_chk(&li->li_tv) == NULL) return; if (argvars[2].v_type != VAR_UNKNOWN) { - char_u *arg2 = get_tv_string_chk(&argvars[2]); + char_u *arg2 = tv_get_string_chk(&argvars[2]); if (arg2 == NULL) return; @@ -14546,7 +14546,7 @@ f_writefile(typval_T *argvars, typval_T *rettv) #endif } - fname = get_tv_string_chk(&argvars[1]); + fname = tv_get_string_chk(&argvars[1]); if (fname == NULL) return; @@ -14580,8 +14580,8 @@ f_writefile(typval_T *argvars, typval_T *rettv) static void f_xor(typval_T *argvars, typval_T *rettv) { - rettv->vval.v_number = get_tv_number_chk(&argvars[0], NULL) - ^ get_tv_number_chk(&argvars[1], NULL); + rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) + ^ tv_get_number_chk(&argvars[1], NULL); } #endif /* FEAT_EVAL */ diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 5cb326ef8..06df5affe 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -8913,7 +8913,7 @@ ex_oldfiles(exarg_T *eap UNUSED) for (li = l->lv_first; li != NULL && !got_int; li = li->li_next) { ++nr; - fname = get_tv_string(&li->li_tv); + fname = tv_get_string(&li->li_tv); if (!message_filtered(fname)) { msg_outnum((long)nr); diff --git a/src/json.c b/src/json.c index 8e6288e63..60637714a 100644 --- a/src/json.c +++ b/src/json.c @@ -873,7 +873,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) if (top_item != NULL && top_item->jd_type == JSON_OBJECT_KEY && cur_item != NULL) { - top_item->jd_key = get_tv_string_buf_chk(cur_item, key_buf); + top_item->jd_key = tv_get_string_buf_chk(cur_item, key_buf); if (top_item->jd_key == NULL) { clear_tv(cur_item); diff --git a/src/list.c b/src/list.c index 679276c85..2a820232d 100644 --- a/src/list.c +++ b/src/list.c @@ -403,7 +403,7 @@ list_find_nr( *errorp = TRUE; return -1L; } - return (long)get_tv_number_chk(&li->li_tv, errorp); + return (long)tv_get_number_chk(&li->li_tv, errorp); } /* @@ -420,7 +420,7 @@ list_find_str(list_T *l, long idx) EMSGN(_(e_listidx), idx); return NULL; } - return get_tv_string(&li->li_tv); + return tv_get_string(&li->li_tv); } /* @@ -949,7 +949,7 @@ write_list(FILE *fd, list_T *list, int binary) for (li = list->lv_first; li != NULL; li = li->li_next) { - for (s = get_tv_string(&li->li_tv); *s != NUL; ++s) + for (s = tv_get_string(&li->li_tv); *s != NUL; ++s) { if (*s == '\n') c = putc(NUL, fd); diff --git a/src/message.c b/src/message.c index 5a990ff60..f191c78a2 100644 --- a/src/message.c +++ b/src/message.c @@ -4137,7 +4137,7 @@ tv_nr(typval_T *tvs, int *idxp) else { ++*idxp; - n = get_tv_number_chk(&tvs[idx], &err); + n = tv_get_number_chk(&tvs[idx], &err); if (err) n = 0; } @@ -4146,7 +4146,7 @@ tv_nr(typval_T *tvs, int *idxp) /* * Get string argument from "idxp" entry in "tvs". First entry is 1. - * If "tofree" is NULL get_tv_string_chk() is used. Some types (e.g. List) + * If "tofree" is NULL tv_get_string_chk() is used. Some types (e.g. List) * are not converted to a string. * If "tofree" is not NULL echo_string() is used. All types are converted to * a string with the same format as ":echo". The caller must free "*tofree". @@ -4167,7 +4167,7 @@ tv_str(typval_T *tvs, int *idxp, char_u **tofree) if (tofree != NULL) s = (char *)echo_string(&tvs[idx], tofree, numbuf, get_copyID()); else - s = (char *)get_tv_string_chk(&tvs[idx]); + s = (char *)tv_get_string_chk(&tvs[idx]); } return s; } diff --git a/src/misc2.c b/src/misc2.c index a0781d440..3834979b8 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -6593,7 +6593,7 @@ build_argv_from_list(list_T *l, char ***argv, int *argc) *argc = 0; for (li = l->lv_first; li != NULL; li = li->li_next) { - s = get_tv_string_chk(&li->li_tv); + s = tv_get_string_chk(&li->li_tv); if (s == NULL) { int i; diff --git a/src/os_unix.c b/src/os_unix.c index ecb348c4d..d2a8a0ab2 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1678,13 +1678,13 @@ x_IOerror_check(Display *dpy UNUSED) /* * An X IO Error handler, used to catch terminal errors. */ -static int xterm_dpy_was_reset = FALSE; +static int xterm_dpy_retry_count = 0; static int x_IOerror_handler(Display *dpy UNUSED) { xterm_dpy = NULL; - xterm_dpy_was_reset = TRUE; + xterm_dpy_retry_count = 5; // Try reconnecting five times x11_window = 0; x11_display = NULL; xterm_Shell = (Widget)0; @@ -1704,9 +1704,9 @@ x_IOerror_handler(Display *dpy UNUSED) static void may_restore_clipboard(void) { - if (xterm_dpy_was_reset) + if (xterm_dpy_retry_count > 0) { - xterm_dpy_was_reset = FALSE; + --xterm_dpy_retry_count; # ifndef LESSTIF_VERSION /* This has been reported to avoid Vim getting stuck. */ @@ -5553,7 +5553,7 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) { typval_T *item = &dict_lookup(hi)->di_tv; - vim_setenv((char_u*)hi->hi_key, get_tv_string(item)); + vim_setenv((char_u*)hi->hi_key, tv_get_string(item)); --todo; } } @@ -7494,6 +7494,8 @@ setup_term_clip(void) { xterm_dpy = XtOpenDisplay(app_context, xterm_display, "vim_xterm", "Vim_xterm", NULL, 0, &z, &strp); + if (xterm_dpy != NULL) + xterm_dpy_retry_count = 0; #if defined(HAVE_SETJMP_H) mch_endjmp(); #endif diff --git a/src/os_win32.c b/src/os_win32.c index f610d211f..c9f7d1cb8 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -5355,7 +5355,7 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal) { typval_T *item = &dict_lookup(hi)->di_tv; WCHAR *wkey = enc_to_utf16((char_u *)hi->hi_key, NULL); - WCHAR *wval = enc_to_utf16(get_tv_string(item), NULL); + WCHAR *wval = enc_to_utf16(tv_get_string(item), NULL); --todo; if (wkey != NULL && wval != NULL) { diff --git a/src/popupmnu.c b/src/popupmnu.c index f3a9f3991..b0fe043ab 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1103,7 +1103,7 @@ ui_post_balloon(char_u *mesg, list_T *list) return; for (idx = 0, li = list->lv_first; li != NULL; li = li->li_next, ++idx) { - char_u *text = get_tv_string_chk(&li->li_tv); + char_u *text = tv_get_string_chk(&li->li_tv); balloon_array[idx].pum_text = vim_strsave( text == NULL ? (char_u *)"" : text); diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 03c650641..bc6808c74 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -82,13 +82,13 @@ typval_T *alloc_tv(void); void free_tv(typval_T *varp); void clear_tv(typval_T *varp); void init_tv(typval_T *varp); -varnumber_T get_tv_number(typval_T *varp); -varnumber_T get_tv_number_chk(typval_T *varp, int *denote); -float_T get_tv_float(typval_T *varp); -char_u *get_tv_string(typval_T *varp); -char_u *get_tv_string_buf(typval_T *varp, char_u *buf); -char_u *get_tv_string_chk(typval_T *varp); -char_u *get_tv_string_buf_chk(typval_T *varp, char_u *buf); +varnumber_T tv_get_number(typval_T *varp); +varnumber_T tv_get_number_chk(typval_T *varp, int *denote); +float_T tv_get_float(typval_T *varp); +char_u *tv_get_string(typval_T *varp); +char_u *tv_get_string_buf(typval_T *varp, char_u *buf); +char_u *tv_get_string_chk(typval_T *varp); +char_u *tv_get_string_buf_chk(typval_T *varp, char_u *buf); dictitem_T *find_var(char_u *name, hashtab_T **htp, int no_autoload); dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, int no_autoload); hashtab_T *find_var_ht(char_u *name, char_u **varname); diff --git a/src/regexp.c b/src/regexp.c index 04116675f..011ee2d75 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -7566,7 +7566,7 @@ vim_regsub_both( /* fill_submatch_list() was called */ clear_submatch_list(&matchList); - eval_result = get_tv_string_buf_chk(&rettv, buf); + eval_result = tv_get_string_buf_chk(&rettv, buf); if (eval_result != NULL) eval_result = vim_strsave(eval_result); clear_tv(&rettv); @@ -4212,7 +4212,7 @@ set_tagstack(win_T *wp, dict_T *d, int action) } if ((di = dict_find(d, (char_u *)"curidx", -1)) != NULL) - tagstack_set_curidx(wp, (int)get_tv_number(&di->di_tv) - 1); + tagstack_set_curidx(wp, (int)tv_get_number(&di->di_tv) - 1); return OK; } diff --git a/src/terminal.c b/src/terminal.c index 5a0165814..20284af53 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -496,7 +496,7 @@ term_start( else if (argvar->v_type != VAR_LIST || argvar->vval.v_list == NULL || argvar->vval.v_list->lv_len < 1 - || (cmd = get_tv_string_chk( + || (cmd = tv_get_string_chk( &argvar->vval.v_list->lv_first->li_tv)) == NULL) cmd = (char_u*)""; @@ -569,7 +569,7 @@ term_start( for (item = argvar->vval.v_list->lv_first; item != NULL; item = item->li_next) { - char_u *s = get_tv_string_chk(&item->li_tv); + char_u *s = tv_get_string_chk(&item->li_tv); char_u *p; if (s == NULL) @@ -1913,7 +1913,7 @@ term_paste_register(int prev_c UNUSED) type = get_reg_type(c, ®len); for (item = l->lv_first; item != NULL; item = item->li_next) { - char_u *s = get_tv_string(&item->li_tv); + char_u *s = tv_get_string(&item->li_tv); #ifdef WIN3264 char_u *tmp = s; @@ -3455,7 +3455,7 @@ set_ansi_colors_list(VTerm *vterm, list_T *list) char_u *color_name; guicolor_T guicolor; - color_name = get_tv_string_chk(&li->li_tv); + color_name = tv_get_string_chk(&li->li_tv); if (color_name == NULL) return FAIL; @@ -3497,7 +3497,7 @@ init_vterm_ansi_colors(VTerm *vterm) static void handle_drop_command(listitem_T *item) { - char_u *fname = get_tv_string(&item->li_tv); + char_u *fname = tv_get_string(&item->li_tv); listitem_T *opt_item = item->li_next; int bufnr; win_T *wp; @@ -3589,7 +3589,7 @@ handle_call_command(term_T *term, channel_T *channel, listitem_T *item) ch_log(channel, "Missing function arguments for call"); return; } - func = get_tv_string(&item->li_tv); + func = tv_get_string(&item->li_tv); if (STRNCMP(func, "Tapi_", 5) != 0) { @@ -3645,7 +3645,7 @@ parse_osc(const char *command, size_t cmdlen, void *user) ch_log(channel, "Missing command"); else { - char_u *cmd = get_tv_string(&item->li_tv); + char_u *cmd = tv_get_string(&item->li_tv); /* Make sure an invoked command doesn't delete the buffer (and the * terminal) under our fingers. */ @@ -3826,7 +3826,7 @@ term_get_buf(typval_T *argvars, char *where) { buf_T *buf; - (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */ + (void)tv_get_number(&argvars[0]); /* issue errmsg if type error */ ++emsg_off; buf = get_buf_tv(&argvars[0], FALSE); --emsg_off; @@ -3921,7 +3921,7 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED) } } - fname = get_tv_string_chk(&argvars[1]); + fname = tv_get_string_chk(&argvars[1]); if (fname == NULL) return; if (mch_stat((char *)fname, &st) >= 0) @@ -4370,9 +4370,9 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff) char_u *textline = NULL; /* First open the files. If this fails bail out. */ - fname1 = get_tv_string_buf_chk(&argvars[0], buf1); + fname1 = tv_get_string_buf_chk(&argvars[0], buf1); if (do_diff) - fname2 = get_tv_string_buf_chk(&argvars[1], buf2); + fname2 = tv_get_string_buf_chk(&argvars[1], buf2); if (fname1 == NULL || (do_diff && fname2 == NULL)) { EMSG(_(e_invarg)); @@ -4740,8 +4740,8 @@ f_term_getattr(typval_T *argvars, typval_T *rettv) {"reverse", HL_INVERSE}, }; - attr = get_tv_number(&argvars[0]); - name = get_tv_string_chk(&argvars[1]); + attr = tv_get_number(&argvars[0]); + name = tv_get_string_chk(&argvars[1]); if (name == NULL) return; @@ -4811,7 +4811,7 @@ get_row_number(typval_T *tv, term_T *term) && tv->vval.v_string != NULL && STRCMP(tv->vval.v_string, ".") == 0) return term->tl_cursor_pos.row; - return (int)get_tv_number(tv) - 1; + return (int)tv_get_number(tv) - 1; } /* @@ -4911,9 +4911,9 @@ f_term_setsize(typval_T *argvars UNUSED, typval_T *rettv UNUSED) if (buf->b_term->tl_vterm == NULL) return; term = buf->b_term; - rows = get_tv_number(&argvars[1]); + rows = tv_get_number(&argvars[1]); rows = rows <= 0 ? term->tl_rows : rows; - cols = get_tv_number(&argvars[2]); + cols = tv_get_number(&argvars[2]); cols = cols <= 0 ? term->tl_cols : cols; vterm_set_size(term->tl_vterm, rows, cols); /* handle_resize() will resize the windows */ @@ -4977,7 +4977,7 @@ f_term_gettty(typval_T *argvars, typval_T *rettv) if (buf == NULL) return; if (argvars[1].v_type != VAR_UNKNOWN) - num = get_tv_number(&argvars[1]); + num = tv_get_number(&argvars[1]); switch (num) { @@ -4990,7 +4990,7 @@ f_term_gettty(typval_T *argvars, typval_T *rettv) p = buf->b_term->tl_job->jv_tty_in; break; default: - EMSG2(_(e_invarg2), get_tv_string(&argvars[1])); + EMSG2(_(e_invarg2), tv_get_string(&argvars[1])); return; } if (p != NULL) @@ -5139,7 +5139,7 @@ f_term_sendkeys(typval_T *argvars, typval_T *rettv) if (buf == NULL) return; - msg = get_tv_string_chk(&argvars[1]); + msg = tv_get_string_chk(&argvars[1]); if (msg == NULL) return; term = buf->b_term; @@ -5241,7 +5241,7 @@ f_term_setrestore(typval_T *argvars UNUSED, typval_T *rettv UNUSED) return; term = buf->b_term; vim_free(term->tl_command); - cmd = get_tv_string_chk(&argvars[1]); + cmd = tv_get_string_chk(&argvars[1]); if (cmd != NULL) term->tl_command = vim_strsave(cmd); else @@ -5263,7 +5263,7 @@ f_term_setkill(typval_T *argvars UNUSED, typval_T *rettv UNUSED) return; term = buf->b_term; vim_free(term->tl_kill); - how = get_tv_string_chk(&argvars[1]); + how = tv_get_string_chk(&argvars[1]); if (how != NULL) term->tl_kill = vim_strsave(how); else @@ -5347,7 +5347,7 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED) /* Wait for some time for any channel I/O. */ if (argvars[1].v_type != VAR_UNKNOWN) - wait = get_tv_number(&argvars[1]); + wait = tv_get_number(&argvars[1]); ui_delay(wait, TRUE); mch_check_messages(); diff --git a/src/textprop.c b/src/textprop.c index 05df2e139..ec9a87d51 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -154,8 +154,8 @@ f_prop_add(typval_T *argvars, typval_T *rettv UNUSED) textprop_T tmp_prop; int i; - lnum = get_tv_number(&argvars[0]); - col = get_tv_number(&argvars[1]); + lnum = tv_get_number(&argvars[0]); + col = tv_get_number(&argvars[1]); if (col < 1) { EMSGN(_(e_invalid_col), (long)col); @@ -352,14 +352,14 @@ text_prop_type_by_id(buf_T *buf, int id) void f_prop_clear(typval_T *argvars, typval_T *rettv UNUSED) { - linenr_T start = get_tv_number(&argvars[0]); + linenr_T start = tv_get_number(&argvars[0]); linenr_T end = start; linenr_T lnum; buf_T *buf = curbuf; if (argvars[1].v_type != VAR_UNKNOWN) { - end = get_tv_number(&argvars[1]); + end = tv_get_number(&argvars[1]); if (argvars[2].v_type != VAR_UNKNOWN) { if (get_bufnr_from_arg(&argvars[2], &buf) == FAIL) @@ -405,7 +405,7 @@ f_prop_clear(typval_T *argvars, typval_T *rettv UNUSED) void f_prop_list(typval_T *argvars, typval_T *rettv) { - linenr_T lnum = get_tv_number(&argvars[0]); + linenr_T lnum = tv_get_number(&argvars[0]); buf_T *buf = curbuf; if (argvars[1].v_type != VAR_UNKNOWN) @@ -476,10 +476,10 @@ f_prop_remove(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { - start = get_tv_number(&argvars[1]); + start = tv_get_number(&argvars[1]); end = start; if (argvars[2].v_type != VAR_UNKNOWN) - end = get_tv_number(&argvars[2]); + end = tv_get_number(&argvars[2]); if (start < 1 || end < 1) { EMSG(_(e_invrange)); @@ -586,7 +586,7 @@ prop_type_set(typval_T *argvars, int add) dictitem_T *di; proptype_T *prop; - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (*name == NUL) { EMSG(_(e_invarg)); @@ -656,12 +656,12 @@ prop_type_set(typval_T *argvars, int add) di = dict_find(dict, (char_u *)"priority", -1); if (di != NULL) - prop->pt_priority = get_tv_number(&di->di_tv); + prop->pt_priority = tv_get_number(&di->di_tv); di = dict_find(dict, (char_u *)"start_incl", -1); if (di != NULL) { - if (get_tv_number(&di->di_tv)) + if (tv_get_number(&di->di_tv)) prop->pt_flags |= PT_FLAG_INS_START_INCL; else prop->pt_flags &= ~PT_FLAG_INS_START_INCL; @@ -670,7 +670,7 @@ prop_type_set(typval_T *argvars, int add) di = dict_find(dict, (char_u *)"end_incl", -1); if (di != NULL) { - if (get_tv_number(&di->di_tv)) + if (tv_get_number(&di->di_tv)) prop->pt_flags |= PT_FLAG_INS_END_INCL; else prop->pt_flags &= ~PT_FLAG_INS_END_INCL; @@ -706,7 +706,7 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED) buf_T *buf = NULL; hashitem_T *hi; - name = get_tv_string(&argvars[0]); + name = tv_get_string(&argvars[0]); if (*name == NUL) { EMSG(_(e_invarg)); @@ -740,7 +740,7 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED) void f_prop_type_get(typval_T *argvars, typval_T *rettv UNUSED) { - char_u *name = get_tv_string(&argvars[0]); + char_u *name = tv_get_string(&argvars[0]); if (*name == NUL) { diff --git a/src/version.c b/src/version.c index d59c9a2b0..daeabf5cc 100644 --- a/src/version.c +++ b/src/version.c @@ -800,6 +800,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 615, +/**/ 614, /**/ 613, diff --git a/src/window.c b/src/window.c index e8e816b83..cba9785c3 100644 --- a/src/window.c +++ b/src/window.c @@ -6867,7 +6867,7 @@ match_add( subli = subl->lv_first; if (subli == NULL) goto fail; - lnum = get_tv_number_chk(&subli->li_tv, &error); + lnum = tv_get_number_chk(&subli->li_tv, &error); if (error == TRUE) goto fail; if (lnum == 0) @@ -6879,13 +6879,13 @@ match_add( subli = subli->li_next; if (subli != NULL) { - col = get_tv_number_chk(&subli->li_tv, &error); + col = tv_get_number_chk(&subli->li_tv, &error); if (error == TRUE) goto fail; subli = subli->li_next; if (subli != NULL) { - len = get_tv_number_chk(&subli->li_tv, &error); + len = tv_get_number_chk(&subli->li_tv, &error); if (error == TRUE) goto fail; } @@ -7132,7 +7132,7 @@ win_getid(typval_T *argvars) if (argvars[0].v_type == VAR_UNKNOWN) return curwin->w_id; - winnr = get_tv_number(&argvars[0]); + winnr = tv_get_number(&argvars[0]); if (winnr > 0) { if (argvars[1].v_type == VAR_UNKNOWN) @@ -7140,7 +7140,7 @@ win_getid(typval_T *argvars) else { tabpage_T *tp; - int tabnr = get_tv_number(&argvars[1]); + int tabnr = tv_get_number(&argvars[1]); FOR_ALL_TABPAGES(tp) if (--tabnr == 0) @@ -7164,7 +7164,7 @@ win_gotoid(typval_T *argvars) { win_T *wp; tabpage_T *tp; - int id = get_tv_number(&argvars[0]); + int id = tv_get_number(&argvars[0]); FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_id == id) @@ -7182,7 +7182,7 @@ win_id2tabwin(typval_T *argvars, list_T *list) tabpage_T *tp; int winnr = 1; int tabnr = 1; - int id = get_tv_number(&argvars[0]); + int id = tv_get_number(&argvars[0]); FOR_ALL_TABPAGES(tp) { @@ -7208,7 +7208,7 @@ win_id2wp(typval_T *argvars) { win_T *wp; tabpage_T *tp; - int id = get_tv_number(&argvars[0]); + int id = tv_get_number(&argvars[0]); FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_id == id) @@ -7222,7 +7222,7 @@ win_id2win(typval_T *argvars) { win_T *wp; int nr = 1; - int id = get_tv_number(&argvars[0]); + int id = tv_get_number(&argvars[0]); FOR_ALL_WINDOWS(wp) { @@ -7238,7 +7238,7 @@ win_findbuf(typval_T *argvars, list_T *list) { win_T *wp; tabpage_T *tp; - int bufnr = get_tv_number(&argvars[0]); + int bufnr = tv_get_number(&argvars[0]); FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer->b_fnum == bufnr) |