mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
parent
46734cf7c1
commit
b9bdd0f61e
@ -131,7 +131,7 @@ Object nvim_eval(String expr, Error *err)
|
|||||||
try_start();
|
try_start();
|
||||||
|
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
int ok = eval0((char_u *)expr.data, &rettv, NULL, true);
|
int ok = eval0(expr.data, &rettv, NULL, true);
|
||||||
|
|
||||||
if (!try_end(err)) {
|
if (!try_end(err)) {
|
||||||
if (ok == FAIL) {
|
if (ok == FAIL) {
|
||||||
@ -246,7 +246,7 @@ Object nvim_call_dict_function(Object dict, String fn, Array args, Error *err)
|
|||||||
switch (dict.type) {
|
switch (dict.type) {
|
||||||
case kObjectTypeString:
|
case kObjectTypeString:
|
||||||
try_start();
|
try_start();
|
||||||
if (eval0((char_u *)dict.data.string.data, &rettv, NULL, true) == FAIL) {
|
if (eval0(dict.data.string.data, &rettv, NULL, true) == FAIL) {
|
||||||
api_set_error(err, kErrorTypeException,
|
api_set_error(err, kErrorTypeException,
|
||||||
"Failed to evaluate dict expression");
|
"Failed to evaluate dict expression");
|
||||||
}
|
}
|
||||||
|
@ -1816,7 +1816,7 @@ bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, bool f
|
|||||||
// set v:cmdarg (only when there is a matching pattern)
|
// set v:cmdarg (only when there is a matching pattern)
|
||||||
save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG);
|
save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG);
|
||||||
if (eap != NULL) {
|
if (eap != NULL) {
|
||||||
save_cmdarg = set_cmdarg(eap, NULL);
|
save_cmdarg = (char_u *)set_cmdarg(eap, NULL);
|
||||||
set_vim_var_nr(VV_CMDBANG, (long)eap->forceit);
|
set_vim_var_nr(VV_CMDBANG, (long)eap->forceit);
|
||||||
} else {
|
} else {
|
||||||
save_cmdarg = NULL; // avoid gcc warning
|
save_cmdarg = NULL; // avoid gcc warning
|
||||||
@ -1845,7 +1845,7 @@ bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, bool f
|
|||||||
|
|
||||||
|
|
||||||
if (eap != NULL) {
|
if (eap != NULL) {
|
||||||
(void)set_cmdarg(NULL, save_cmdarg);
|
(void)set_cmdarg(NULL, (char *)save_cmdarg);
|
||||||
set_vim_var_nr(VV_CMDBANG, save_cmdbang);
|
set_vim_var_nr(VV_CMDBANG, save_cmdbang);
|
||||||
}
|
}
|
||||||
// delete from active_apc_list
|
// delete from active_apc_list
|
||||||
|
@ -3421,7 +3421,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
|
|||||||
};
|
};
|
||||||
set_var(S_LEN("g:statusline_winid"), &tv, false);
|
set_var(S_LEN("g:statusline_winid"), &tv, false);
|
||||||
|
|
||||||
usefmt = eval_to_string_safe(fmt + 2, NULL, use_sandbox);
|
usefmt = (char_u *)eval_to_string_safe((char *)fmt + 2, NULL, use_sandbox);
|
||||||
if (usefmt == NULL) {
|
if (usefmt == NULL) {
|
||||||
usefmt = fmt;
|
usefmt = fmt;
|
||||||
}
|
}
|
||||||
@ -3878,9 +3878,9 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
|
|||||||
|
|
||||||
// Store the current buffer number as a string variable
|
// Store the current buffer number as a string variable
|
||||||
vim_snprintf(buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
|
vim_snprintf(buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
|
||||||
set_internal_string_var("g:actual_curbuf", (char_u *)buf_tmp);
|
set_internal_string_var("g:actual_curbuf", buf_tmp);
|
||||||
vim_snprintf((char *)win_tmp, sizeof(win_tmp), "%d", curwin->handle);
|
vim_snprintf((char *)win_tmp, sizeof(win_tmp), "%d", curwin->handle);
|
||||||
set_internal_string_var("g:actual_curwin", win_tmp);
|
set_internal_string_var("g:actual_curwin", (char *)win_tmp);
|
||||||
|
|
||||||
buf_T *const save_curbuf = curbuf;
|
buf_T *const save_curbuf = curbuf;
|
||||||
win_T *const save_curwin = curwin;
|
win_T *const save_curwin = curwin;
|
||||||
@ -3893,7 +3893,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: The result stored in `t` is unused.
|
// Note: The result stored in `t` is unused.
|
||||||
str = (char *)eval_to_string_safe(out_p, &t, use_sandbox);
|
str = eval_to_string_safe((char *)out_p, (char **)&t, use_sandbox);
|
||||||
|
|
||||||
curwin = save_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = save_curbuf;
|
curbuf = save_curbuf;
|
||||||
|
@ -461,7 +461,7 @@ static typval_T *eval_expr_no_emsg(struct debuggy *const bp)
|
|||||||
{
|
{
|
||||||
// Disable error messages, a bad expression would make Vim unusable.
|
// Disable error messages, a bad expression would make Vim unusable.
|
||||||
emsg_off++;
|
emsg_off++;
|
||||||
typval_T *const tv = eval_expr(bp->dbg_name);
|
typval_T *const tv = eval_expr((char *)bp->dbg_name);
|
||||||
emsg_off--;
|
emsg_off--;
|
||||||
return tv;
|
return tv;
|
||||||
}
|
}
|
||||||
|
@ -4028,7 +4028,7 @@ static void expand_by_function(int type, char_u *base)
|
|||||||
curbuf_save = curbuf;
|
curbuf_save = curbuf;
|
||||||
|
|
||||||
// Call a function, which returns a list or dict.
|
// Call a function, which returns a list or dict.
|
||||||
if (call_vim_function(funcname, 2, args, &rettv) == OK) {
|
if (call_vim_function((char *)funcname, 2, args, &rettv) == OK) {
|
||||||
switch (rettv.v_type) {
|
switch (rettv.v_type) {
|
||||||
case VAR_LIST:
|
case VAR_LIST:
|
||||||
matchlist = rettv.vval.v_list;
|
matchlist = rettv.vval.v_list;
|
||||||
@ -5311,7 +5311,7 @@ static int ins_complete(int c, bool enable_pum)
|
|||||||
pos = curwin->w_cursor;
|
pos = curwin->w_cursor;
|
||||||
curwin_save = curwin;
|
curwin_save = curwin;
|
||||||
curbuf_save = curbuf;
|
curbuf_save = curbuf;
|
||||||
int col = call_func_retnr(funcname, 2, args);
|
int col = call_func_retnr((char *)funcname, 2, args);
|
||||||
|
|
||||||
State = save_State;
|
State = save_State;
|
||||||
if (curwin_save != curwin || curbuf_save != curbuf) {
|
if (curwin_save != curwin || curbuf_save != curbuf) {
|
||||||
|
946
src/nvim/eval.c
946
src/nvim/eval.c
File diff suppressed because it is too large
Load Diff
@ -62,7 +62,7 @@ typedef struct lval_S {
|
|||||||
long ll_n2; ///< Second index for list range.
|
long ll_n2; ///< Second index for list range.
|
||||||
dict_T *ll_dict; ///< The Dictionary or NULL.
|
dict_T *ll_dict; ///< The Dictionary or NULL.
|
||||||
dictitem_T *ll_di; ///< The dictitem or NULL.
|
dictitem_T *ll_di; ///< The dictitem or NULL.
|
||||||
char_u *ll_newkey; ///< New key for Dict in allocated memory or NULL.
|
char *ll_newkey; ///< New key for Dict in allocated memory or NULL.
|
||||||
blob_T *ll_blob; ///< The Blob or NULL.
|
blob_T *ll_blob; ///< The Blob or NULL.
|
||||||
} lval_T;
|
} lval_T;
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ typedef enum {
|
|||||||
kDictListItems, ///< List dictionary contents: [keys, values].
|
kDictListItems, ///< List dictionary contents: [keys, values].
|
||||||
} DictListType;
|
} DictListType;
|
||||||
|
|
||||||
typedef int (*ex_unletlock_callback)(lval_T *, char_u *, exarg_T *, int);
|
typedef int (*ex_unletlock_callback)(lval_T *, char *, exarg_T *, int);
|
||||||
|
|
||||||
// Used for checking if local variables or arguments used in a lambda.
|
// Used for checking if local variables or arguments used in a lambda.
|
||||||
extern bool *eval_lavars_used;
|
extern bool *eval_lavars_used;
|
||||||
|
@ -129,7 +129,7 @@ char_u *get_function_name(expand_T *xp, int idx)
|
|||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
if (*name != NUL && *name != '<'
|
if (*name != NUL && *name != '<'
|
||||||
&& STRNCMP("g:", xp->xp_pattern, 2) == 0) {
|
&& STRNCMP("g:", xp->xp_pattern, 2) == 0) {
|
||||||
return cat_prefix_varname('g', name);
|
return (char_u *)cat_prefix_varname('g', (char *)name);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -772,7 +772,7 @@ static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
func = argvars[0].vval.v_string;
|
func = argvars[0].vval.v_string;
|
||||||
} else if (argvars[0].v_type == VAR_PARTIAL) {
|
} else if (argvars[0].v_type == VAR_PARTIAL) {
|
||||||
partial = argvars[0].vval.v_partial;
|
partial = argvars[0].vval.v_partial;
|
||||||
func = partial_name(partial);
|
func = (char_u *)partial_name(partial);
|
||||||
} else if (nlua_is_table_from_lua(&argvars[0])) {
|
} else if (nlua_is_table_from_lua(&argvars[0])) {
|
||||||
// TODO(tjdevries): UnifiedCallback
|
// TODO(tjdevries): UnifiedCallback
|
||||||
func = nlua_register_table_as_callable(&argvars[0]);
|
func = nlua_register_table_as_callable(&argvars[0]);
|
||||||
@ -1896,7 +1896,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *const expr_start = s;
|
const char *const expr_start = s;
|
||||||
if (s == NULL || eval1((char_u **)&s, rettv, true) == FAIL) {
|
if (s == NULL || eval1((char **)&s, rettv, true) == FAIL) {
|
||||||
if (expr_start != NULL && !aborting()) {
|
if (expr_start != NULL && !aborting()) {
|
||||||
semsg(_(e_invexpr2), expr_start);
|
semsg(_(e_invexpr2), expr_start);
|
||||||
}
|
}
|
||||||
@ -2489,8 +2489,8 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
len = strlen(fname);
|
len = strlen(fname);
|
||||||
if (*mods != NUL) {
|
if (*mods != NUL) {
|
||||||
size_t usedlen = 0;
|
size_t usedlen = 0;
|
||||||
(void)modify_fname((char_u *)mods, false, &usedlen,
|
(void)modify_fname((char *)mods, false, &usedlen,
|
||||||
(char_u **)&fname, &fbuf, &len);
|
(char **)&fname, (char **)&fbuf, &len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4886,7 +4886,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
dictitem_T *di;
|
dictitem_T *di;
|
||||||
|
|
||||||
rettv->vval.v_number = -1;
|
rettv->vval.v_number = -1;
|
||||||
const char_u *const end = get_lval((char_u *)tv_get_string(&argvars[0]),
|
const char_u *const end = (char_u *)get_lval((char *)tv_get_string(&argvars[0]),
|
||||||
NULL,
|
NULL,
|
||||||
&lv, false, false,
|
&lv, false, false,
|
||||||
GLV_NO_AUTOLOAD|GLV_READ_ONLY,
|
GLV_NO_AUTOLOAD|GLV_READ_ONLY,
|
||||||
@ -7506,7 +7506,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
func_name = argvars[1].vval.v_string;
|
func_name = argvars[1].vval.v_string;
|
||||||
} else if (argvars[1].v_type == VAR_PARTIAL) {
|
} else if (argvars[1].v_type == VAR_PARTIAL) {
|
||||||
partial = argvars[1].vval.v_partial;
|
partial = argvars[1].vval.v_partial;
|
||||||
func_name = partial_name(partial);
|
func_name = (char_u *)partial_name(partial);
|
||||||
} else {
|
} else {
|
||||||
func_name = (const char_u *)tv_get_string(&argvars[1]);
|
func_name = (const char_u *)tv_get_string(&argvars[1]);
|
||||||
}
|
}
|
||||||
@ -10303,8 +10303,8 @@ static void f_substitute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
|| flg == NULL) {
|
|| flg == NULL) {
|
||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
} else {
|
} else {
|
||||||
rettv->vval.v_string = do_string_sub((char_u *)str, (char_u *)pat,
|
rettv->vval.v_string = (char_u *)do_string_sub((char *)str, (char *)pat,
|
||||||
(char_u *)sub, expr, (char_u *)flg);
|
(char *)sub, expr, (char *)flg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,8 +343,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
|
|||||||
case VAR_PARTIAL: {
|
case VAR_PARTIAL: {
|
||||||
partial_T *const pt = tv->vval.v_partial;
|
partial_T *const pt = tv->vval.v_partial;
|
||||||
(void)pt;
|
(void)pt;
|
||||||
TYPVAL_ENCODE_CONV_FUNC_START( // -V547
|
TYPVAL_ENCODE_CONV_FUNC_START(tv, (pt == NULL ? NULL : (char_u *)partial_name(pt))); // -V547
|
||||||
tv, (pt == NULL ? NULL : partial_name(pt)));
|
|
||||||
_mp_push(*mpstack, ((MPConvStackVal) { // -V779
|
_mp_push(*mpstack, ((MPConvStackVal) { // -V779
|
||||||
.type = kMPConvPartial,
|
.type = kMPConvPartial,
|
||||||
.tv = tv,
|
.tv = tv,
|
||||||
|
@ -132,7 +132,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
|
|||||||
p = skipwhite(p) + 1;
|
p = skipwhite(p) + 1;
|
||||||
p = skipwhite(p);
|
p = skipwhite(p);
|
||||||
char_u *expr = p;
|
char_u *expr = p;
|
||||||
if (eval1(&p, &rettv, false) != FAIL) {
|
if (eval1((char **)&p, &rettv, false) != FAIL) {
|
||||||
ga_grow(default_args, 1);
|
ga_grow(default_args, 1);
|
||||||
|
|
||||||
// trim trailing whitespace
|
// trim trailing whitespace
|
||||||
@ -253,7 +253,7 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate)
|
|||||||
// Get the start and the end of the expression.
|
// Get the start and the end of the expression.
|
||||||
*arg = skipwhite(*arg + 1);
|
*arg = skipwhite(*arg + 1);
|
||||||
s = *arg;
|
s = *arg;
|
||||||
ret = skip_expr(arg);
|
ret = skip_expr((char **)arg);
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
goto errret;
|
goto errret;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ char_u *deref_func_name(const char *name, int *lenp, partial_T **const partialp,
|
|||||||
if (partialp != NULL) {
|
if (partialp != NULL) {
|
||||||
*partialp = pt;
|
*partialp = pt;
|
||||||
}
|
}
|
||||||
char_u *s = partial_name(pt);
|
char_u *s = (char_u *)partial_name(pt);
|
||||||
*lenp = (int)STRLEN(s);
|
*lenp = (int)STRLEN(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ int get_func_tv(const char_u *name, int len, typval_T *rettv, char_u **arg, func
|
|||||||
if (*argp == ')' || *argp == ',' || *argp == NUL) {
|
if (*argp == ')' || *argp == ',' || *argp == NUL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (eval1(&argp, &argvars[argcount], funcexe->evaluate) == FAIL) {
|
if (eval1((char **)&argp, &argvars[argcount], funcexe->evaluate) == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -941,7 +941,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
|
|
||||||
default_expr = ((char_u **)(fp->uf_def_args.ga_data))
|
default_expr = ((char_u **)(fp->uf_def_args.ga_data))
|
||||||
[ai + fp->uf_def_args.ga_len];
|
[ai + fp->uf_def_args.ga_len];
|
||||||
if (eval1(&default_expr, &def_rettv, true) == FAIL) {
|
if (eval1((char **)&default_expr, &def_rettv, true) == FAIL) {
|
||||||
default_arg_err = true;
|
default_arg_err = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1103,7 +1103,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
// A Lambda always has the command "return {expr}". It is much faster
|
// A Lambda always has the command "return {expr}". It is much faster
|
||||||
// to evaluate {expr} directly.
|
// to evaluate {expr} directly.
|
||||||
ex_nesting_level++;
|
ex_nesting_level++;
|
||||||
(void)eval1(&p, rettv, true);
|
(void)eval1((char **)&p, rettv, true);
|
||||||
ex_nesting_level--;
|
ex_nesting_level--;
|
||||||
} else {
|
} else {
|
||||||
// call do_cmdline() to execute the lines
|
// call do_cmdline() to execute the lines
|
||||||
@ -1150,18 +1150,18 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
smsg(_("%s returning #%" PRId64 ""),
|
smsg(_("%s returning #%" PRId64 ""),
|
||||||
sourcing_name, (int64_t)fc->rettv->vval.v_number);
|
sourcing_name, (int64_t)fc->rettv->vval.v_number);
|
||||||
} else {
|
} else {
|
||||||
char_u buf[MSG_BUF_LEN];
|
char buf[MSG_BUF_LEN];
|
||||||
|
|
||||||
// The value may be very long. Skip the middle part, so that we
|
// The value may be very long. Skip the middle part, so that we
|
||||||
// have some idea how it starts and ends. smsg() would always
|
// have some idea how it starts and ends. smsg() would always
|
||||||
// truncate it at the end. Don't want errors such as E724 here.
|
// truncate it at the end. Don't want errors such as E724 here.
|
||||||
emsg_off++;
|
emsg_off++;
|
||||||
char_u *s = (char_u *)encode_tv2string(fc->rettv, NULL);
|
char *s = encode_tv2string(fc->rettv, NULL);
|
||||||
char_u *tofree = s;
|
char *tofree = s;
|
||||||
emsg_off--;
|
emsg_off--;
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
if (vim_strsize(s) > MSG_BUF_CLEN) {
|
if (vim_strsize((char_u *)s) > MSG_BUF_CLEN) {
|
||||||
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN, MSG_BUF_LEN);
|
||||||
s = buf;
|
s = buf;
|
||||||
}
|
}
|
||||||
smsg(_("%s returning %s"), sourcing_name, s);
|
smsg(_("%s returning %s"), sourcing_name, s);
|
||||||
@ -1724,7 +1724,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note that TFN_ flags use the same values as GLV_ flags.
|
// Note that TFN_ flags use the same values as GLV_ flags.
|
||||||
end = get_lval((char_u *)start, NULL, &lv, false, skip, flags | GLV_READ_ONLY,
|
end = (char_u *)get_lval((char *)start, NULL, &lv, false, skip, flags | GLV_READ_ONLY,
|
||||||
lead > 2 ? 0 : FNE_CHECK_START);
|
lead > 2 ? 0 : FNE_CHECK_START);
|
||||||
if (end == start) {
|
if (end == start) {
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
@ -1743,7 +1743,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
|
|||||||
semsg(_(e_invarg2), start);
|
semsg(_(e_invarg2), start);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*pp = (char_u *)find_name_end(start, NULL, NULL, FNE_INCL_BR);
|
*pp = (char_u *)find_name_end((char *)start, NULL, NULL, FNE_INCL_BR);
|
||||||
}
|
}
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
@ -1751,7 +1751,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
|
|||||||
if (lv.ll_tv != NULL) {
|
if (lv.ll_tv != NULL) {
|
||||||
if (fdp != NULL) {
|
if (fdp != NULL) {
|
||||||
fdp->fd_dict = lv.ll_dict;
|
fdp->fd_dict = lv.ll_dict;
|
||||||
fdp->fd_newkey = lv.ll_newkey;
|
fdp->fd_newkey = (char_u *)lv.ll_newkey;
|
||||||
lv.ll_newkey = NULL;
|
lv.ll_newkey = NULL;
|
||||||
fdp->fd_di = lv.ll_di;
|
fdp->fd_di = lv.ll_di;
|
||||||
}
|
}
|
||||||
@ -1770,7 +1770,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
|
|||||||
memcpy(name, end + 1, (size_t)len);
|
memcpy(name, end + 1, (size_t)len);
|
||||||
*pp = (char_u *)end + 1 + len;
|
*pp = (char_u *)end + 1 + len;
|
||||||
} else {
|
} else {
|
||||||
name = vim_strsave(partial_name(lv.ll_tv->vval.v_partial));
|
name = vim_strsave((char_u *)partial_name(lv.ll_tv->vval.v_partial));
|
||||||
*pp = (char_u *)end;
|
*pp = (char_u *)end;
|
||||||
}
|
}
|
||||||
if (partial != NULL) {
|
if (partial != NULL) {
|
||||||
@ -2873,7 +2873,7 @@ void ex_return(exarg_T *eap)
|
|||||||
|
|
||||||
eap->nextcmd = NULL;
|
eap->nextcmd = NULL;
|
||||||
if ((*arg != NUL && *arg != '|' && *arg != '\n')
|
if ((*arg != NUL && *arg != '|' && *arg != '\n')
|
||||||
&& eval0(arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) {
|
&& eval0((char *)arg, &rettv, (char **)&eap->nextcmd, !eap->skip) != FAIL) {
|
||||||
if (!eap->skip) {
|
if (!eap->skip) {
|
||||||
returning = do_return(eap, false, true, &rettv);
|
returning = do_return(eap, false, true, &rettv);
|
||||||
} else {
|
} else {
|
||||||
@ -2926,7 +2926,7 @@ void ex_call(exarg_T *eap)
|
|||||||
// instead to skip to any following command, e.g. for:
|
// instead to skip to any following command, e.g. for:
|
||||||
// :if 0 | call dict.foo().bar() | endif.
|
// :if 0 | call dict.foo().bar() | endif.
|
||||||
emsg_skip++;
|
emsg_skip++;
|
||||||
if (eval0(eap->arg, &rettv, &eap->nextcmd, false) != FAIL) {
|
if (eval0((char *)eap->arg, &rettv, (char **)&eap->nextcmd, false) != FAIL) {
|
||||||
tv_clear(&rettv);
|
tv_clear(&rettv);
|
||||||
}
|
}
|
||||||
emsg_skip--;
|
emsg_skip--;
|
||||||
@ -2995,7 +2995,7 @@ void ex_call(exarg_T *eap)
|
|||||||
|
|
||||||
// Handle a function returning a Funcref, Dictionary or List.
|
// Handle a function returning a Funcref, Dictionary or List.
|
||||||
if (handle_subscript((const char **)&arg, &rettv, true, true,
|
if (handle_subscript((const char **)&arg, &rettv, true, true,
|
||||||
(const char_u *)name, (const char_u **)&name)
|
(const char *)name, (const char **)&name)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
failed = true;
|
failed = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1627,14 +1627,14 @@ void ex_compiler(exarg_T *eap)
|
|||||||
// Set "b:current_compiler" from "current_compiler".
|
// Set "b:current_compiler" from "current_compiler".
|
||||||
p = get_var_value("g:current_compiler");
|
p = get_var_value("g:current_compiler");
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
set_internal_string_var("b:current_compiler", p);
|
set_internal_string_var("b:current_compiler", (char *)p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore "current_compiler" for ":compiler {name}".
|
// Restore "current_compiler" for ":compiler {name}".
|
||||||
if (!eap->forceit) {
|
if (!eap->forceit) {
|
||||||
if (old_cur_comp != NULL) {
|
if (old_cur_comp != NULL) {
|
||||||
set_internal_string_var("g:current_compiler",
|
set_internal_string_var("g:current_compiler",
|
||||||
old_cur_comp);
|
(char *)old_cur_comp);
|
||||||
xfree(old_cur_comp);
|
xfree(old_cur_comp);
|
||||||
} else {
|
} else {
|
||||||
do_unlet(S_LEN("g:current_compiler"), true);
|
do_unlet(S_LEN("g:current_compiler"), true);
|
||||||
|
@ -152,8 +152,8 @@ static void save_dbg_stuff(struct dbg_stuff *dsp)
|
|||||||
dsp->trylevel = trylevel; trylevel = 0;
|
dsp->trylevel = trylevel; trylevel = 0;
|
||||||
dsp->force_abort = force_abort; force_abort = FALSE;
|
dsp->force_abort = force_abort; force_abort = FALSE;
|
||||||
dsp->caught_stack = caught_stack; caught_stack = NULL;
|
dsp->caught_stack = caught_stack; caught_stack = NULL;
|
||||||
dsp->vv_exception = (char *)v_exception(NULL);
|
dsp->vv_exception = v_exception(NULL);
|
||||||
dsp->vv_throwpoint = (char *)v_throwpoint(NULL);
|
dsp->vv_throwpoint = v_throwpoint(NULL);
|
||||||
|
|
||||||
// Necessary for debugging an inactive ":catch", ":finally", ":endtry".
|
// Necessary for debugging an inactive ":catch", ":finally", ":endtry".
|
||||||
dsp->did_emsg = did_emsg; did_emsg = false;
|
dsp->did_emsg = did_emsg; did_emsg = false;
|
||||||
@ -169,8 +169,8 @@ static void restore_dbg_stuff(struct dbg_stuff *dsp)
|
|||||||
trylevel = dsp->trylevel;
|
trylevel = dsp->trylevel;
|
||||||
force_abort = dsp->force_abort;
|
force_abort = dsp->force_abort;
|
||||||
caught_stack = dsp->caught_stack;
|
caught_stack = dsp->caught_stack;
|
||||||
(void)v_exception((char_u *)dsp->vv_exception);
|
(void)v_exception(dsp->vv_exception);
|
||||||
(void)v_throwpoint((char_u *)dsp->vv_throwpoint);
|
(void)v_throwpoint(dsp->vv_throwpoint);
|
||||||
did_emsg = dsp->did_emsg;
|
did_emsg = dsp->did_emsg;
|
||||||
got_int = dsp->got_int;
|
got_int = dsp->got_int;
|
||||||
need_rethrow = dsp->need_rethrow;
|
need_rethrow = dsp->need_rethrow;
|
||||||
@ -3701,7 +3701,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
case CMD_lexpr:
|
case CMD_lexpr:
|
||||||
case CMD_laddexpr:
|
case CMD_laddexpr:
|
||||||
case CMD_lgetexpr:
|
case CMD_lgetexpr:
|
||||||
set_context_for_expression(xp, (char_u *)arg, ea.cmdidx);
|
set_context_for_expression(xp, (char *)arg, ea.cmdidx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_unlet:
|
case CMD_unlet:
|
||||||
@ -4591,7 +4591,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
|
|||||||
// Skip over `=expr`, wildcards in it are not expanded.
|
// Skip over `=expr`, wildcards in it are not expanded.
|
||||||
if (p[0] == '`' && p[1] == '=') {
|
if (p[0] == '`' && p[1] == '=') {
|
||||||
p += 2;
|
p += 2;
|
||||||
(void)skip_expr((char_u **)&p);
|
(void)skip_expr(&p);
|
||||||
if (*p == '`') {
|
if (*p == '`') {
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
@ -4806,7 +4806,7 @@ void separate_nextcmd(exarg_T *eap)
|
|||||||
} else if (p[0] == '`' && p[1] == '=' && (eap->argt & EX_XFILE)) {
|
} else if (p[0] == '`' && p[1] == '=' && (eap->argt & EX_XFILE)) {
|
||||||
// Skip over `=expr` when wildcards are expanded.
|
// Skip over `=expr` when wildcards are expanded.
|
||||||
p += 2;
|
p += 2;
|
||||||
(void)skip_expr((char_u **)&p);
|
(void)skip_expr(&p);
|
||||||
if (*p == NUL) { // stop at NUL after CTRL-V
|
if (*p == NUL) { // stop at NUL after CTRL-V
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -6669,7 +6669,7 @@ static void ex_colorscheme(exarg_T *eap)
|
|||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
emsg_off++;
|
emsg_off++;
|
||||||
p = (char *)eval_to_string((char_u *)expr, NULL, false);
|
p = eval_to_string(expr, NULL, false);
|
||||||
emsg_off--;
|
emsg_off--;
|
||||||
xfree(expr);
|
xfree(expr);
|
||||||
|
|
||||||
@ -8527,7 +8527,7 @@ static void ex_redir(exarg_T *eap)
|
|||||||
append = FALSE;
|
append = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var_redir_start(skipwhite((char_u *)arg), append) == OK) {
|
if (var_redir_start((char *)skipwhite((char_u *)arg), append) == OK) {
|
||||||
redir_vname = 1;
|
redir_vname = 1;
|
||||||
}
|
}
|
||||||
} else { // TODO(vim): redirect to a buffer
|
} else { // TODO(vim): redirect to a buffer
|
||||||
@ -9383,8 +9383,8 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
|
|||||||
resultlen = (size_t)(s - result);
|
resultlen = (size_t)(s - result);
|
||||||
}
|
}
|
||||||
} else if (!skip_mod) {
|
} else if (!skip_mod) {
|
||||||
valid |= modify_fname(src, tilde_file, usedlen, (char_u **)&result,
|
valid |= modify_fname((char *)src, tilde_file, usedlen, &result,
|
||||||
(char_u **)&resultbuf, &resultlen);
|
&resultbuf, &resultlen);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
*errormsg = "";
|
*errormsg = "";
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -801,7 +801,7 @@ void ex_eval(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
typval_T tv;
|
typval_T tv;
|
||||||
|
|
||||||
if (eval0(eap->arg, &tv, &eap->nextcmd, !eap->skip) == OK) {
|
if (eval0((char *)eap->arg, &tv, (char **)&eap->nextcmd, !eap->skip) == OK) {
|
||||||
tv_clear(&tv);
|
tv_clear(&tv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -822,7 +822,7 @@ void ex_if(exarg_T *eap)
|
|||||||
skip = CHECK_SKIP;
|
skip = CHECK_SKIP;
|
||||||
|
|
||||||
bool error;
|
bool error;
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip);
|
||||||
|
|
||||||
if (!skip && !error) {
|
if (!skip && !error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -911,7 +911,7 @@ void ex_else(exarg_T *eap)
|
|||||||
|
|
||||||
if (eap->cmdidx == CMD_elseif) {
|
if (eap->cmdidx == CMD_elseif) {
|
||||||
bool error;
|
bool error;
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip);
|
||||||
// When throwing error exceptions, we want to throw always the first
|
// When throwing error exceptions, we want to throw always the first
|
||||||
// of several errors in a row. This is what actually happens when
|
// of several errors in a row. This is what actually happens when
|
||||||
// a conditional error was detected above and there is another failure
|
// a conditional error was detected above and there is another failure
|
||||||
@ -962,7 +962,7 @@ void ex_while(exarg_T *eap)
|
|||||||
/*
|
/*
|
||||||
* ":while bool-expr"
|
* ":while bool-expr"
|
||||||
*/
|
*/
|
||||||
result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
|
result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip);
|
||||||
} else {
|
} else {
|
||||||
void *fi;
|
void *fi;
|
||||||
|
|
||||||
@ -976,13 +976,13 @@ void ex_while(exarg_T *eap)
|
|||||||
error = FALSE;
|
error = FALSE;
|
||||||
} else {
|
} else {
|
||||||
// Evaluate the argument and get the info in a structure.
|
// Evaluate the argument and get the info in a structure.
|
||||||
fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip);
|
fi = eval_for_line((char *)eap->arg, &error, (char **)&eap->nextcmd, skip);
|
||||||
cstack->cs_forinfo[cstack->cs_idx] = fi;
|
cstack->cs_forinfo[cstack->cs_idx] = fi;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use the element at the start of the list and advance
|
// use the element at the start of the list and advance
|
||||||
if (!error && fi != NULL && !skip) {
|
if (!error && fi != NULL && !skip) {
|
||||||
result = next_for_item(fi, eap->arg);
|
result = next_for_item(fi, (char *)eap->arg);
|
||||||
} else {
|
} else {
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -335,10 +335,10 @@ static void get_healthcheck_cb(char_u *path, void *cookie)
|
|||||||
pattern = ".*[\\/]\\([^\\/]*\\)\\.vim$";
|
pattern = ".*[\\/]\\([^\\/]*\\)\\.vim$";
|
||||||
}
|
}
|
||||||
|
|
||||||
res = do_string_sub(path, (char_u *)pattern, (char_u *)sub, NULL, (char_u *)"g");
|
res = (char_u *)do_string_sub((char *)path, pattern, sub, NULL, "g");
|
||||||
if (hcookie->is_lua && res != NULL) {
|
if (hcookie->is_lua && res != NULL) {
|
||||||
// Replace slashes with dots as represented by the healthcheck plugin.
|
// Replace slashes with dots as represented by the healthcheck plugin.
|
||||||
char_u *ares = do_string_sub(res, (char_u *)"[\\/]", (char_u *)".", NULL, (char_u *)"g");
|
char_u *ares = (char_u *)do_string_sub((char *)res, "[\\/]", ".", NULL, "g");
|
||||||
xfree(res);
|
xfree(res);
|
||||||
res = ares;
|
res = ares;
|
||||||
}
|
}
|
||||||
@ -4715,7 +4715,7 @@ void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline
|
|||||||
|
|
||||||
if (use_ccline && ccline.cmdfirstc == '=') {
|
if (use_ccline && ccline.cmdfirstc == '=') {
|
||||||
// pass CMD_SIZE because there is no real command
|
// pass CMD_SIZE because there is no real command
|
||||||
set_context_for_expression(xp, str, CMD_SIZE);
|
set_context_for_expression(xp, (char *)str, CMD_SIZE);
|
||||||
} else if (use_ccline && ccline.input_fn) {
|
} else if (use_ccline && ccline.input_fn) {
|
||||||
xp->xp_context = ccline.xp_context;
|
xp->xp_context = ccline.xp_context;
|
||||||
xp->xp_pattern = ccline.cmdbuff;
|
xp->xp_pattern = ccline.cmdbuff;
|
||||||
|
@ -1774,7 +1774,9 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldin
|
|||||||
curbuf = wp->w_buffer;
|
curbuf = wp->w_buffer;
|
||||||
|
|
||||||
emsg_silent++; // handle exceptions, but don't display errors
|
emsg_silent++; // handle exceptions, but don't display errors
|
||||||
text = eval_to_string_safe(wp->w_p_fdt, NULL, was_set_insecurely(wp, "foldtext", OPT_LOCAL));
|
text =
|
||||||
|
(char_u *)eval_to_string_safe((char *)wp->w_p_fdt, NULL,
|
||||||
|
was_set_insecurely(wp, "foldtext", OPT_LOCAL));
|
||||||
emsg_silent--;
|
emsg_silent--;
|
||||||
|
|
||||||
if (text == NULL || did_emsg) {
|
if (text == NULL || did_emsg) {
|
||||||
@ -2962,7 +2964,7 @@ static void foldlevelExpr(fline_T *flp)
|
|||||||
// KeyTyped may be reset to 0 when calling a function which invokes
|
// KeyTyped may be reset to 0 when calling a function which invokes
|
||||||
// do_cmdline(). To make 'foldopen' work correctly restore KeyTyped.
|
// do_cmdline(). To make 'foldopen' work correctly restore KeyTyped.
|
||||||
const bool save_keytyped = KeyTyped;
|
const bool save_keytyped = KeyTyped;
|
||||||
const int n = eval_foldexpr(flp->wp->w_p_fde, &c);
|
const int n = eval_foldexpr((char *)flp->wp->w_p_fde, &c);
|
||||||
KeyTyped = save_keytyped;
|
KeyTyped = save_keytyped;
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -4275,7 +4275,7 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
|
|||||||
api_clear_error(&err);
|
api_clear_error(&err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
p = eval_to_string(expr, NULL, false);
|
p = (char_u *)eval_to_string((char *)expr, NULL, false);
|
||||||
xfree(expr);
|
xfree(expr);
|
||||||
}
|
}
|
||||||
textlock--;
|
textlock--;
|
||||||
|
@ -429,8 +429,8 @@ static int cs_add_common(char *arg1, char *arg2, char *flags)
|
|||||||
expand_env((char_u *)arg1, (char_u *)fname, MAXPATHL);
|
expand_env((char_u *)arg1, (char_u *)fname, MAXPATHL);
|
||||||
size_t len = STRLEN(fname);
|
size_t len = STRLEN(fname);
|
||||||
fbuf = (char_u *)fname;
|
fbuf = (char_u *)fname;
|
||||||
(void)modify_fname((char_u *)":p", false, &usedlen,
|
(void)modify_fname(":p", false, &usedlen,
|
||||||
(char_u **)&fname, &fbuf, &len);
|
&fname, (char **)&fbuf, &len);
|
||||||
if (fname == NULL) {
|
if (fname == NULL) {
|
||||||
goto add_err;
|
goto add_err;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ int get_expr_indent(void)
|
|||||||
// Need to make a copy, the 'indentexpr' option could be changed while
|
// Need to make a copy, the 'indentexpr' option could be changed while
|
||||||
// evaluating it.
|
// evaluating it.
|
||||||
char_u *inde_copy = vim_strsave(curbuf->b_p_inde);
|
char_u *inde_copy = vim_strsave(curbuf->b_p_inde);
|
||||||
indent = (int)eval_to_number(inde_copy);
|
indent = (int)eval_to_number((char *)inde_copy);
|
||||||
xfree(inde_copy);
|
xfree(inde_copy);
|
||||||
|
|
||||||
if (use_sandbox) {
|
if (use_sandbox) {
|
||||||
|
@ -3195,7 +3195,7 @@ static void redir_write(const char *const str, const ptrdiff_t maxlen)
|
|||||||
if (redir_reg) {
|
if (redir_reg) {
|
||||||
write_reg_contents(redir_reg, (char_u *)" ", 1, true);
|
write_reg_contents(redir_reg, (char_u *)" ", 1, true);
|
||||||
} else if (redir_vname) {
|
} else if (redir_vname) {
|
||||||
var_redir_str((char_u *)" ", -1);
|
var_redir_str(" ", -1);
|
||||||
} else if (redir_fd != NULL) {
|
} else if (redir_fd != NULL) {
|
||||||
fputs(" ", redir_fd);
|
fputs(" ", redir_fd);
|
||||||
}
|
}
|
||||||
@ -3214,7 +3214,7 @@ static void redir_write(const char *const str, const ptrdiff_t maxlen)
|
|||||||
write_reg_contents(redir_reg, s, len, true);
|
write_reg_contents(redir_reg, s, len, true);
|
||||||
}
|
}
|
||||||
if (redir_vname) {
|
if (redir_vname) {
|
||||||
var_redir_str((char_u *)s, maxlen);
|
var_redir_str((char *)s, maxlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write and adjust the current column.
|
// Write and adjust the current column.
|
||||||
|
@ -774,7 +774,7 @@ char_u *get_expr_line(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nested++;
|
nested++;
|
||||||
rv = eval_to_string(expr_copy, NULL, true);
|
rv = (char_u *)eval_to_string((char *)expr_copy, NULL, true);
|
||||||
nested--;
|
nested--;
|
||||||
xfree(expr_copy);
|
xfree(expr_copy);
|
||||||
return rv;
|
return rv;
|
||||||
@ -4441,7 +4441,7 @@ int fex_format(linenr_T lnum, long count, int c)
|
|||||||
if (use_sandbox) {
|
if (use_sandbox) {
|
||||||
sandbox++;
|
sandbox++;
|
||||||
}
|
}
|
||||||
r = (int)eval_to_number(fex);
|
r = (int)eval_to_number((char *)fex);
|
||||||
if (use_sandbox) {
|
if (use_sandbox) {
|
||||||
sandbox--;
|
sandbox--;
|
||||||
}
|
}
|
||||||
@ -6192,7 +6192,7 @@ static void op_function(const oparg_T *oap)
|
|||||||
// Reset finish_op so that mode() returns the right value.
|
// Reset finish_op so that mode() returns the right value.
|
||||||
finish_op = false;
|
finish_op = false;
|
||||||
|
|
||||||
(void)call_func_retnr(p_opfunc, 1, argv);
|
(void)call_func_retnr((char *)p_opfunc, 1, argv);
|
||||||
|
|
||||||
virtual_op = save_virtual_op;
|
virtual_op = save_virtual_op;
|
||||||
finish_op = save_finish_op;
|
finish_op = save_finish_op;
|
||||||
|
@ -587,7 +587,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
|
|||||||
if (src[0] == '`' && src[1] == '=') {
|
if (src[0] == '`' && src[1] == '=') {
|
||||||
var = src;
|
var = src;
|
||||||
src += 2;
|
src += 2;
|
||||||
(void)skip_expr(&src);
|
(void)skip_expr((char **)&src);
|
||||||
if (*src == '`') {
|
if (*src == '`') {
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
@ -1072,8 +1072,8 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
|
|||||||
size_t usedlen = 0;
|
size_t usedlen = 0;
|
||||||
size_t flen = strlen(homedir_env_mod);
|
size_t flen = strlen(homedir_env_mod);
|
||||||
char_u *fbuf = NULL;
|
char_u *fbuf = NULL;
|
||||||
(void)modify_fname((char_u *)":p", false, &usedlen,
|
(void)modify_fname(":p", false, &usedlen,
|
||||||
(char_u **)&homedir_env_mod, &fbuf, &flen);
|
&homedir_env_mod, (char **)&fbuf, &flen);
|
||||||
flen = strlen(homedir_env_mod);
|
flen = strlen(homedir_env_mod);
|
||||||
assert(homedir_env_mod != homedir_env);
|
assert(homedir_env_mod != homedir_env);
|
||||||
if (vim_ispathsep(homedir_env_mod[flen - 1])) {
|
if (vim_ispathsep(homedir_env_mod[flen - 1])) {
|
||||||
|
@ -1383,7 +1383,7 @@ static int expand_backtick(garray_T *gap, char_u *pat, int flags)
|
|||||||
char_u *cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
|
char_u *cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
|
||||||
|
|
||||||
if (*cmd == '=') { // `={expr}`: Expand expression
|
if (*cmd == '=') { // `={expr}`: Expand expression
|
||||||
buffer = eval_to_string(cmd + 1, &p, true);
|
buffer = (char_u *)eval_to_string((char *)cmd + 1, (char **)&p, true);
|
||||||
} else {
|
} else {
|
||||||
buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
||||||
}
|
}
|
||||||
@ -1678,7 +1678,7 @@ void simplify_filename(char_u *filename)
|
|||||||
static char *eval_includeexpr(const char *const ptr, const size_t len)
|
static char *eval_includeexpr(const char *const ptr, const size_t len)
|
||||||
{
|
{
|
||||||
set_vim_var_string(VV_FNAME, ptr, (ptrdiff_t)len);
|
set_vim_var_string(VV_FNAME, ptr, (ptrdiff_t)len);
|
||||||
char *res = (char *)eval_to_string_safe(curbuf->b_p_inex, NULL,
|
char *res = eval_to_string_safe((char *)curbuf->b_p_inex, NULL,
|
||||||
was_set_insecurely(curwin, "includeexpr", OPT_LOCAL));
|
was_set_insecurely(curwin, "includeexpr", OPT_LOCAL));
|
||||||
set_vim_var_string(VV_FNAME, NULL, 0);
|
set_vim_var_string(VV_FNAME, NULL, 0);
|
||||||
return res;
|
return res;
|
||||||
|
@ -3726,7 +3726,7 @@ static int qf_open_new_cwindow(qf_info_T *qi, int height)
|
|||||||
static void qf_set_title_var(qf_list_T *qfl)
|
static void qf_set_title_var(qf_list_T *qfl)
|
||||||
{
|
{
|
||||||
if (qfl->qf_title != NULL) {
|
if (qfl->qf_title != NULL) {
|
||||||
set_internal_string_var("w:quickfix_title", (char_u *)qfl->qf_title);
|
set_internal_string_var("w:quickfix_title", qfl->qf_title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3929,7 +3929,7 @@ bool qf_process_qftf_option(void)
|
|||||||
|
|
||||||
if (*p_qftf == '{') {
|
if (*p_qftf == '{') {
|
||||||
// Lambda expression
|
// Lambda expression
|
||||||
tv = eval_expr(p_qftf);
|
tv = eval_expr((char *)p_qftf);
|
||||||
if (tv == NULL) {
|
if (tv == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -7035,7 +7035,7 @@ void ex_cexpr(exarg_T *eap)
|
|||||||
// Evaluate the expression. When the result is a string or a list we can
|
// Evaluate the expression. When the result is a string or a list we can
|
||||||
// use it to fill the errorlist.
|
// use it to fill the errorlist.
|
||||||
typval_T tv;
|
typval_T tv;
|
||||||
if (eval0(eap->arg, &tv, &eap->nextcmd, true) != FAIL) {
|
if (eval0((char *)eap->arg, &tv, (char **)&eap->nextcmd, true) != FAIL) {
|
||||||
if ((tv.v_type == VAR_STRING && tv.vval.v_string != NULL)
|
if ((tv.v_type == VAR_STRING && tv.vval.v_string != NULL)
|
||||||
|| tv.v_type == VAR_LIST) {
|
|| tv.v_type == VAR_LIST) {
|
||||||
incr_quickfix_busy();
|
incr_quickfix_busy();
|
||||||
|
@ -1790,7 +1790,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
|
|||||||
} else if (expr->v_type == VAR_PARTIAL) {
|
} else if (expr->v_type == VAR_PARTIAL) {
|
||||||
partial_T *partial = expr->vval.v_partial;
|
partial_T *partial = expr->vval.v_partial;
|
||||||
|
|
||||||
s = partial_name(partial);
|
s = (char_u *)partial_name(partial);
|
||||||
funcexe.partial = partial;
|
funcexe.partial = partial;
|
||||||
call_func(s, -1, &rettv, 1, argv, &funcexe);
|
call_func(s, -1, &rettv, 1, argv, &funcexe);
|
||||||
}
|
}
|
||||||
@ -1810,7 +1810,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
|
|||||||
}
|
}
|
||||||
tv_clear(&rettv);
|
tv_clear(&rettv);
|
||||||
} else {
|
} else {
|
||||||
eval_result = eval_to_string(source + 2, NULL, true);
|
eval_result = (char_u *)eval_to_string((char *)source + 2, NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eval_result != NULL) {
|
if (eval_result != NULL) {
|
||||||
|
@ -826,7 +826,7 @@ static int load_pack_plugin(bool opt, char_u *fname)
|
|||||||
|
|
||||||
// If runtime/filetype.vim wasn't loaded yet, the scripts will be
|
// If runtime/filetype.vim wasn't loaded yet, the scripts will be
|
||||||
// found when it loads.
|
// found when it loads.
|
||||||
if (opt && eval_to_number(cmd) > 0) {
|
if (opt && eval_to_number((char *)cmd) > 0) {
|
||||||
do_cmdline_cmd("augroup filetypedetect");
|
do_cmdline_cmd("augroup filetypedetect");
|
||||||
vim_snprintf((char *)pat, len, ftpat, ffname);
|
vim_snprintf((char *)pat, len, ftpat, ffname);
|
||||||
source_all_matches(pat);
|
source_all_matches(pat);
|
||||||
|
@ -5392,7 +5392,7 @@ bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len)
|
|||||||
curwin = wp;
|
curwin = wp;
|
||||||
STRCPY(buf, "b:keymap_name"); // must be writable
|
STRCPY(buf, "b:keymap_name"); // must be writable
|
||||||
emsg_skip++;
|
emsg_skip++;
|
||||||
s = p = eval_to_string(buf, NULL, false);
|
s = p = (char_u *)eval_to_string((char *)buf, NULL, false);
|
||||||
emsg_skip--;
|
emsg_skip--;
|
||||||
curbuf = old_curbuf;
|
curbuf = old_curbuf;
|
||||||
curwin = old_curwin;
|
curwin = old_curwin;
|
||||||
|
@ -3372,7 +3372,7 @@ static void spell_suggest_expr(suginfo_T *su, char_u *expr)
|
|||||||
// The work is split up in a few parts to avoid having to export
|
// The work is split up in a few parts to avoid having to export
|
||||||
// suginfo_T.
|
// suginfo_T.
|
||||||
// First evaluate the expression and get the resulting list.
|
// First evaluate the expression and get the resulting list.
|
||||||
list_T *const list = eval_spell_expr(su->su_badword, expr);
|
list_T *const list = eval_spell_expr((char *)su->su_badword, (char *)expr);
|
||||||
if (list != NULL) {
|
if (list != NULL) {
|
||||||
// Loop over the items in the list.
|
// Loop over the items in the list.
|
||||||
TV_LIST_ITER(list, li, {
|
TV_LIST_ITER(list, li, {
|
||||||
|
@ -5674,14 +5674,14 @@ void ex_ownsyntax(exarg_T *eap)
|
|||||||
// Move value of b:current_syntax to w:current_syntax.
|
// Move value of b:current_syntax to w:current_syntax.
|
||||||
new_value = get_var_value("b:current_syntax");
|
new_value = get_var_value("b:current_syntax");
|
||||||
if (new_value != NULL) {
|
if (new_value != NULL) {
|
||||||
set_internal_string_var("w:current_syntax", new_value);
|
set_internal_string_var("w:current_syntax", (char *)new_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore value of b:current_syntax.
|
// Restore value of b:current_syntax.
|
||||||
if (old_value == NULL) {
|
if (old_value == NULL) {
|
||||||
do_unlet(S_LEN("b:current_syntax"), true);
|
do_unlet(S_LEN("b:current_syntax"), true);
|
||||||
} else {
|
} else {
|
||||||
set_internal_string_var("b:current_syntax", old_value);
|
set_internal_string_var("b:current_syntax", (char *)old_value);
|
||||||
xfree(old_value);
|
xfree(old_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1182,7 +1182,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
|
|||||||
flags & TAG_REGEXP ? "r": "");
|
flags & TAG_REGEXP ? "r": "");
|
||||||
|
|
||||||
save_pos = curwin->w_cursor;
|
save_pos = curwin->w_cursor;
|
||||||
result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv);
|
result = call_vim_function((char *)curbuf->b_p_tfu, 3, args, &rettv);
|
||||||
curwin->w_cursor = save_pos; // restore the cursor position
|
curwin->w_cursor = save_pos; // restore the cursor position
|
||||||
d->dv_refcount--;
|
d->dv_refcount--;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ static int assert_match_common(typval_T *argvars, assert_type_T atype)
|
|||||||
|
|
||||||
if (pat == NULL || text == NULL) {
|
if (pat == NULL || text == NULL) {
|
||||||
emsg(_(e_invarg));
|
emsg(_(e_invarg));
|
||||||
} else if (pattern_match((char_u *)pat, (char_u *)text, false)
|
} else if (pattern_match((char *)pat, (char *)text, false)
|
||||||
!= (atype == ASSERT_MATCH)) {
|
!= (atype == ASSERT_MATCH)) {
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
prepare_assert_error(&ga);
|
prepare_assert_error(&ga);
|
||||||
|
Loading…
Reference in New Issue
Block a user