aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-05-03 11:02:04 +0200
committerGitHub <noreply@github.com>2022-05-03 11:02:04 +0200
commit8ea84eee570fd1ec560fe149e611d10034d9a223 (patch)
tree807bb0bcb4a551285e7c1f739b1b201d49d58261 /src
parent46734cf7c1e5abe8e452354db6914364bfe89f0d (diff)
parentb9bdd0f61e5e7365c07aadbc3f796556b6d85fdf (diff)
downloadrneovim-8ea84eee570fd1ec560fe149e611d10034d9a223.tar.gz
rneovim-8ea84eee570fd1ec560fe149e611d10034d9a223.tar.bz2
rneovim-8ea84eee570fd1ec560fe149e611d10034d9a223.zip
Merge pull request #18345 from dundargoc/refactor/remove-char_u
refactor: replace char_u variables and functions with char
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/vimscript.c4
-rw-r--r--src/nvim/autocmd.c4
-rw-r--r--src/nvim/buffer.c8
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/eval.c964
-rw-r--r--src/nvim/eval.h4
-rw-r--r--src/nvim/eval/funcs.c26
-rw-r--r--src/nvim/eval/typval_encode.c.h3
-rw-r--r--src/nvim/eval/userfunc.c38
-rw-r--r--src/nvim/ex_cmds2.c4
-rw-r--r--src/nvim/ex_docmd.c22
-rw-r--r--src/nvim/ex_eval.c12
-rw-r--r--src/nvim/ex_getln.c6
-rw-r--r--src/nvim/fold.c6
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/if_cscope.c4
-rw-r--r--src/nvim/indent.c2
-rw-r--r--src/nvim/message.c4
-rw-r--r--src/nvim/ops.c6
-rw-r--r--src/nvim/os/env.c6
-rw-r--r--src/nvim/path.c6
-rw-r--r--src/nvim/quickfix.c6
-rw-r--r--src/nvim/regexp.c4
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/screen.c2
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/syntax.c4
-rw-r--r--src/nvim/tag.c2
-rw-r--r--src/nvim/testing.c2
30 files changed, 574 insertions, 587 deletions
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c
index 4123674fe7..40ac0b8b64 100644
--- a/src/nvim/api/vimscript.c
+++ b/src/nvim/api/vimscript.c
@@ -131,7 +131,7 @@ Object nvim_eval(String expr, Error *err)
try_start();
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 (ok == FAIL) {
@@ -246,7 +246,7 @@ Object nvim_call_dict_function(Object dict, String fn, Array args, Error *err)
switch (dict.type) {
case kObjectTypeString:
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,
"Failed to evaluate dict expression");
}
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 9bc0a4fabf..cd726b70b6 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -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)
save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG);
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);
} else {
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) {
- (void)set_cmdarg(NULL, save_cmdarg);
+ (void)set_cmdarg(NULL, (char *)save_cmdarg);
set_vim_var_nr(VV_CMDBANG, save_cmdbang);
}
// delete from active_apc_list
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index c70d845c42..14ed9921a0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -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);
- 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) {
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
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);
- 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;
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.
- 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;
curbuf = save_curbuf;
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index c6fd8aade3..cf062cfbe8 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -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.
emsg_off++;
- typval_T *const tv = eval_expr(bp->dbg_name);
+ typval_T *const tv = eval_expr((char *)bp->dbg_name);
emsg_off--;
return tv;
}
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index a94f7a803a..6a6d433228 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -4028,7 +4028,7 @@ static void expand_by_function(int type, char_u *base)
curbuf_save = curbuf;
// 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) {
case VAR_LIST:
matchlist = rettv.vval.v_list;
@@ -5311,7 +5311,7 @@ static int ins_complete(int c, bool enable_pum)
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
- int col = call_func_retnr(funcname, 2, args);
+ int col = call_func_retnr((char *)funcname, 2, args);
State = save_State;
if (curwin_save != curwin || curbuf_save != curbuf) {
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 3023b1e774..b4c3e62ddf 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -73,7 +73,7 @@ static char *e_string_list_or_blob_required = N_("E1098: String, List or Blob re
// TODO(ZyX-I): move to eval/executor
static char *e_letwrong = N_("E734: Wrong variable type for %s=");
-static char_u * const namespace_char = (char_u *)"abglstvw";
+static char * const namespace_char = "abglstvw";
/// Variable used for g:
static ScopeDictDictItem globvars_var;
@@ -103,7 +103,7 @@ static garray_T ga_scripts = { 0, 0, sizeof(scriptvar_T *), 4, NULL };
static int echo_attr = 0; // attributes used for ":echo"
// The names of packages that once were loaded are remembered.
-static garray_T ga_loaded = { 0, 0, sizeof(char_u *), 4, NULL };
+static garray_T ga_loaded = { 0, 0, sizeof(char *), 4, NULL };
/*
* Info used by a ":for" loop.
@@ -115,7 +115,7 @@ typedef struct {
list_T *fi_list; // list being used
int fi_bi; // index of blob
blob_T *fi_blob; // blob being used
- char_u *fi_string; // copy of string being used
+ char *fi_string; // copy of string being used
int fi_byte_idx; // byte index in fi_string
} forinfo_T;
@@ -500,12 +500,12 @@ void eval_clear(void)
/// Set an internal variable to a string value. Creates the variable if it does
/// not already exist.
-void set_internal_string_var(const char *name, char_u *value)
+void set_internal_string_var(const char *name, char *value)
FUNC_ATTR_NONNULL_ARG(1)
{
typval_T tv = {
.v_type = VAR_STRING,
- .vval.v_string = value,
+ .vval.v_string = (char_u *)value,
};
set_var(name, strlen(name), &tv, true);
@@ -513,15 +513,15 @@ void set_internal_string_var(const char *name, char_u *value)
static lval_T *redir_lval = NULL;
static garray_T redir_ga; // Only valid when redir_lval is not NULL.
-static char_u *redir_endp = NULL;
-static char_u *redir_varname = NULL;
+static char *redir_endp = NULL;
+static char *redir_varname = NULL;
/// Start recording command output to a variable
///
/// @param append append to an existing variable
///
/// @return OK if successfully completed the setup. FAIL otherwise.
-int var_redir_start(char_u *name, int append)
+int var_redir_start(char *name, int append)
{
int save_emsg;
int err;
@@ -534,7 +534,7 @@ int var_redir_start(char_u *name, int append)
}
// Make a copy of the name, it is used in redir_lval until redir ends.
- redir_varname = vim_strsave(name);
+ redir_varname = xstrdup(name);
redir_lval = xcalloc(1, sizeof(lval_T));
@@ -588,7 +588,7 @@ int var_redir_start(char_u *name, int append)
/// :redir => foo
/// :let foo
/// :redir END
-void var_redir_str(char_u *value, int value_len)
+void var_redir_str(char *value, int value_len)
{
int len;
@@ -646,7 +646,7 @@ int eval_charconvert(const char *const enc_from, const char *const enc_to,
set_vim_var_string(VV_CC_TO, enc_to, -1);
set_vim_var_string(VV_FNAME_IN, fname_from, -1);
set_vim_var_string(VV_FNAME_OUT, fname_to, -1);
- if (eval_to_bool(p_ccv, &err, NULL, false)) {
+ if (eval_to_bool((char *)p_ccv, &err, NULL, false)) {
err = true;
}
set_vim_var_string(VV_CC_FROM, NULL, -1);
@@ -666,7 +666,7 @@ int eval_printexpr(const char *const fname, const char *const args)
set_vim_var_string(VV_FNAME_IN, fname, -1);
set_vim_var_string(VV_CMDARG, args, -1);
- if (eval_to_bool(p_pexpr, &err, NULL, false)) {
+ if (eval_to_bool((char *)p_pexpr, &err, NULL, false)) {
err = true;
}
set_vim_var_string(VV_FNAME_IN, NULL, -1);
@@ -686,7 +686,7 @@ void eval_diff(const char *const origfile, const char *const newfile, const char
set_vim_var_string(VV_FNAME_IN, origfile, -1);
set_vim_var_string(VV_FNAME_NEW, newfile, -1);
set_vim_var_string(VV_FNAME_OUT, outfile, -1);
- (void)eval_to_bool(p_dex, &err, NULL, FALSE);
+ (void)eval_to_bool((char *)p_dex, &err, NULL, false);
set_vim_var_string(VV_FNAME_IN, NULL, -1);
set_vim_var_string(VV_FNAME_NEW, NULL, -1);
set_vim_var_string(VV_FNAME_OUT, NULL, -1);
@@ -699,7 +699,7 @@ void eval_patch(const char *const origfile, const char *const difffile, const ch
set_vim_var_string(VV_FNAME_IN, origfile, -1);
set_vim_var_string(VV_FNAME_DIFF, difffile, -1);
set_vim_var_string(VV_FNAME_OUT, outfile, -1);
- (void)eval_to_bool(p_pex, &err, NULL, FALSE);
+ (void)eval_to_bool((char *)p_pex, &err, NULL, false);
set_vim_var_string(VV_FNAME_IN, NULL, -1);
set_vim_var_string(VV_FNAME_DIFF, NULL, -1);
set_vim_var_string(VV_FNAME_OUT, NULL, -1);
@@ -711,7 +711,7 @@ void eval_patch(const char *const origfile, const char *const difffile, const ch
/// @param skip only parse, don't execute
///
/// @return TRUE or FALSE.
-int eval_to_bool(char_u *arg, bool *error, char_u **nextcmd, int skip)
+int eval_to_bool(char *arg, bool *error, char **nextcmd, int skip)
{
typval_T tv;
bool retval = false;
@@ -736,10 +736,10 @@ int eval_to_bool(char_u *arg, bool *error, char_u **nextcmd, int skip)
}
/// Call eval1() and give an error message if not done at a lower level.
-static int eval1_emsg(char_u **arg, typval_T *rettv, bool evaluate)
+static int eval1_emsg(char **arg, typval_T *rettv, bool evaluate)
FUNC_ATTR_NONNULL_ARG(1, 2)
{
- const char_u *const start = *arg;
+ const char *const start = *arg;
const int did_emsg_before = did_emsg;
const int called_emsg_before = called_emsg;
@@ -773,36 +773,36 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
funcexe_T funcexe = FUNCEXE_INIT;
if (expr->v_type == VAR_FUNC) {
- const char_u *const s = expr->vval.v_string;
+ const char *const s = (char *)expr->vval.v_string;
if (s == NULL || *s == NUL) {
return FAIL;
}
funcexe.evaluate = true;
- if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) {
+ if (call_func((char_u *)s, -1, rettv, argc, argv, &funcexe) == FAIL) {
return FAIL;
}
} else if (expr->v_type == VAR_PARTIAL) {
partial_T *const partial = expr->vval.v_partial;
- const char_u *const s = partial_name(partial);
+ const char *const s = partial_name(partial);
if (s == NULL || *s == NUL) {
return FAIL;
}
funcexe.evaluate = true;
funcexe.partial = partial;
- if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) {
+ if (call_func((char_u *)s, -1, rettv, argc, argv, &funcexe) == FAIL) {
return FAIL;
}
} else {
char buf[NUMBUFLEN];
- char_u *s = (char_u *)tv_get_string_buf_chk(expr, buf);
+ char *s = (char *)tv_get_string_buf_chk(expr, buf);
if (s == NULL) {
return FAIL;
}
- s = skipwhite(s);
+ s = (char *)skipwhite((char_u *)s);
if (eval1_emsg(&s, rettv, true) == FAIL) {
return FAIL;
}
- if (*skipwhite(s) != NUL) { // check for trailing chars after expr
+ if (*skipwhite((char_u *)s) != NUL) { // check for trailing chars after expr
tv_clear(rettv);
semsg(_(e_invexpr2), s);
return FAIL;
@@ -845,7 +845,7 @@ char *eval_to_string_skip(const char *arg, const char **nextcmd, const bool skip
if (skip) {
emsg_skip++;
}
- if (eval0((char_u *)arg, &tv, (char_u **)nextcmd, !skip) == FAIL || skip) {
+ if (eval0((char *)arg, &tv, (char **)nextcmd, !skip) == FAIL || skip) {
retval = NULL;
} else {
retval = xstrdup(tv_get_string(&tv));
@@ -861,12 +861,12 @@ char *eval_to_string_skip(const char *arg, const char **nextcmd, const bool skip
/// Skip over an expression at "*pp".
///
/// @return FAIL for an error, OK otherwise.
-int skip_expr(char_u **pp)
+int skip_expr(char **pp)
{
typval_T rettv;
- *pp = skipwhite(*pp);
- return eval1(pp, &rettv, FALSE);
+ *pp = (char *)skipwhite((char_u *)(*pp));
+ return eval1(pp, &rettv, false);
}
/// Top level evaluation function, returning a string.
@@ -875,7 +875,7 @@ int skip_expr(char_u **pp)
/// a Float to a String.
///
/// @return pointer to allocated memory, or NULL for failure.
-char_u *eval_to_string(char_u *arg, char_u **nextcmd, bool convert)
+char *eval_to_string(char *arg, char **nextcmd, bool convert)
{
typval_T tv;
char *retval;
@@ -904,16 +904,16 @@ char_u *eval_to_string(char_u *arg, char_u **nextcmd, bool convert)
tv_clear(&tv);
}
- return (char_u *)retval;
+ return retval;
}
/// Call eval_to_string() without using current local variables and using
/// textlock.
///
/// @param use_sandbox when TRUE, use the sandbox.
-char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox)
+char *eval_to_string_safe(char *arg, char **nextcmd, int use_sandbox)
{
- char_u *retval;
+ char *retval;
funccal_entry_T funccal_entry;
save_funccal(&funccal_entry);
@@ -934,11 +934,11 @@ char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd, int use_sandbox)
/// Evaluates "expr" silently.
///
/// @return -1 for an error.
-varnumber_T eval_to_number(char_u *expr)
+varnumber_T eval_to_number(char *expr)
{
typval_T rettv;
varnumber_T retval;
- char_u *p = skipwhite(expr);
+ char *p = (char *)skipwhite((char_u *)expr);
++emsg_off;
@@ -957,7 +957,7 @@ varnumber_T eval_to_number(char_u *expr)
///
/// @return an allocated typval_T with the result or
/// NULL when there is an error.
-typval_T *eval_expr(char_u *arg)
+typval_T *eval_expr(char *arg)
{
typval_T *tv = xmalloc(sizeof(*tv));
if (eval0(arg, tv, NULL, true) == FAIL) {
@@ -1009,17 +1009,17 @@ void find_win_for_curbuf(void)
/// For the "expr:" part of 'spellsuggest'.
///
/// @return NULL when there is an error.
-list_T *eval_spell_expr(char_u *badword, char_u *expr)
+list_T *eval_spell_expr(char *badword, char *expr)
{
typval_T save_val;
typval_T rettv;
list_T *list = NULL;
- char_u *p = skipwhite(expr);
+ char *p = (char *)skipwhite((char_u *)expr);
// Set "v:val" to the bad word.
prepare_vimvar(VV_VAL, &save_val);
vimvars[VV_VAL].vv_type = VAR_STRING;
- vimvars[VV_VAL].vv_str = badword;
+ vimvars[VV_VAL].vv_str = (char_u *)badword;
if (p_verbose == 0) {
++emsg_off;
}
@@ -1073,7 +1073,7 @@ int get_spellword(list_T *const list, const char **ret_word)
// should have type VAR_UNKNOWN.
//
// @return OK or FAIL.
-int call_vim_function(const char_u *func, int argc, typval_T *argv, typval_T *rettv)
+int call_vim_function(const char *func, int argc, typval_T *argv, typval_T *rettv)
FUNC_ATTR_NONNULL_ALL
{
int ret;
@@ -1082,7 +1082,7 @@ int call_vim_function(const char_u *func, int argc, typval_T *argv, typval_T *re
if (len >= 6 && !memcmp(func, "v:lua.", 6)) {
func += 6;
- len = check_luafunc_name((const char *)func, false);
+ len = check_luafunc_name(func, false);
if (len == 0) {
ret = FAIL;
goto fail;
@@ -1096,7 +1096,7 @@ int call_vim_function(const char_u *func, int argc, typval_T *argv, typval_T *re
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = true;
funcexe.partial = pt;
- ret = call_func(func, len, rettv, argc, argv, &funcexe);
+ ret = call_func((char_u *)func, len, rettv, argc, argv, &funcexe);
fail:
if (ret == FAIL) {
@@ -1112,13 +1112,13 @@ fail:
/// @param[in] argv Array with typval_T arguments.
///
/// @return -1 when calling function fails, result of function otherwise.
-varnumber_T call_func_retnr(const char_u *func, int argc, typval_T *argv)
+varnumber_T call_func_retnr(const char *func, int argc, typval_T *argv)
FUNC_ATTR_NONNULL_ALL
{
typval_T rettv;
varnumber_T retval;
- if (call_vim_function(func, argc, argv, &rettv) == FAIL) {
+ if (call_vim_function((char *)func, argc, argv, &rettv) == FAIL) {
return -1;
}
retval = tv_get_number_chk(&rettv, NULL);
@@ -1138,7 +1138,7 @@ char *call_func_retstr(const char *const func, int argc, typval_T *argv)
{
typval_T rettv;
// All arguments are passed as strings, no conversion to number.
- if (call_vim_function((const char_u *)func, argc, argv, &rettv)
+ if (call_vim_function(func, argc, argv, &rettv)
== FAIL) {
return NULL;
}
@@ -1155,13 +1155,13 @@ char *call_func_retstr(const char *const func, int argc, typval_T *argv)
///
/// @return [allocated] NULL when calling function fails or return tv is not a
/// List, allocated List otherwise.
-void *call_func_retlist(const char_u *func, int argc, typval_T *argv)
+void *call_func_retlist(const char *func, int argc, typval_T *argv)
FUNC_ATTR_NONNULL_ALL
{
typval_T rettv;
// All arguments are passed as strings, no conversion to number.
- if (call_vim_function(func, argc, argv, &rettv) == FAIL) {
+ if (call_vim_function((char *)func, argc, argv, &rettv) == FAIL) {
return NULL;
}
@@ -1212,7 +1212,7 @@ void prof_child_exit(proftime_T *tm)
/// Evaluate 'foldexpr'. Returns the foldlevel, and any character preceding
/// it in "*cp". Doesn't give error messages.
-int eval_foldexpr(char_u *arg, int *cp)
+int eval_foldexpr(char *arg, int *cp)
{
typval_T tv;
varnumber_T retval;
@@ -1235,11 +1235,11 @@ int eval_foldexpr(char_u *arg, int *cp)
} else {
// If the result is a string, check if there is a non-digit before
// the number.
- char_u *s = tv.vval.v_string;
+ char *s = (char *)tv.vval.v_string;
if (!ascii_isdigit(*s) && *s != '-') {
- *cp = *s++;
+ *cp = (char_u)(*s++);
}
- retval = atol((char *)s);
+ retval = atol(s);
}
tv_clear(&tv);
}
@@ -1273,13 +1273,13 @@ void ex_const(exarg_T *eap)
/// indentation in the 'cmd' line) is stripped.
///
/// @return a List with {lines} or NULL.
-static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
+static list_T *heredoc_get(exarg_T *eap, char *cmd)
{
- char_u *marker;
- char_u *p;
+ char *marker;
+ char *p;
int marker_indent_len = 0;
int text_indent_len = 0;
- char_u *text_indent = NULL;
+ char *text_indent = NULL;
if (eap->getline == NULL) {
emsg(_("E991: cannot use =<< here"));
@@ -1287,16 +1287,16 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
}
// Check for the optional 'trim' word before the marker
- cmd = skipwhite(cmd);
+ cmd = (char *)skipwhite((char_u *)cmd);
if (STRNCMP(cmd, "trim", 4) == 0
&& (cmd[4] == NUL || ascii_iswhite(cmd[4]))) {
- cmd = skipwhite(cmd + 4);
+ cmd = (char *)skipwhite((char_u *)cmd + 4);
// Trim the indentation from all the lines in the here document.
// The amount of indentation trimmed is the same as the indentation of
// the first line after the :let command line. To find the end marker
// the indent of the :let command line is trimmed.
- p = *eap->cmdlinep;
+ p = (char *)(*eap->cmdlinep);
while (ascii_iswhite(*p)) {
p++;
marker_indent_len++;
@@ -1306,9 +1306,9 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
// The marker is the next word.
if (*cmd != NUL && *cmd != '"') {
- marker = skipwhite(cmd);
- p = skiptowhite(marker);
- if (*skipwhite(p) != NUL && *skipwhite(p) != '"') {
+ marker = (char *)skipwhite((char_u *)cmd);
+ p = (char *)skiptowhite((char_u *)marker);
+ if (*skipwhite((char_u *)p) != NUL && *skipwhite((char_u *)p) != '"') {
emsg(_(e_trailing));
return NULL;
}
@@ -1327,7 +1327,7 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
int mi = 0;
int ti = 0;
- char_u *theline = eap->getline(NUL, eap->cookie, 0, false);
+ char *theline = (char *)eap->getline(NUL, eap->cookie, 0, false);
if (theline == NULL) {
semsg(_("E990: Missing end marker '%s'"), marker);
break;
@@ -1351,7 +1351,7 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
p++;
text_indent_len++;
}
- text_indent = vim_strnsave(theline, text_indent_len);
+ text_indent = xstrnsave(theline, text_indent_len);
}
// with "trim": skip the indent matching the first line
if (text_indent != NULL) {
@@ -1362,7 +1362,7 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
}
}
- tv_list_append_string(l, (char *)(theline + ti), -1);
+ tv_list_append_string(l, theline + ti, -1);
xfree(theline);
}
xfree(text_indent);
@@ -1389,24 +1389,24 @@ void ex_let(exarg_T *eap)
static void ex_let_const(exarg_T *eap, const bool is_const)
{
- char_u *arg = eap->arg;
- char_u *expr = NULL;
+ char *arg = (char *)eap->arg;
+ char *expr = NULL;
typval_T rettv;
int i;
int var_count = 0;
int semicolon = 0;
- char_u op[2];
- char_u *argend;
- int first = TRUE;
+ char op[2];
+ char *argend;
+ int first = true;
- argend = (char_u *)skip_var_list(arg, &var_count, &semicolon);
+ argend = (char *)skip_var_list(arg, &var_count, &semicolon);
if (argend == NULL) {
return;
}
if (argend > arg && argend[-1] == '.') { // For var.='str'.
argend--;
}
- expr = skipwhite(argend);
+ expr = (char *)skipwhite((char_u *)argend);
if (*expr != '=' && !((vim_strchr((char_u *)"+-*/%.", *expr) != NULL
&& expr[1] == '=') || STRNCMP(expr, "..=", 3) == 0)) {
// ":let" without "=": list variables
@@ -1414,7 +1414,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
emsg(_(e_invarg));
} else if (!ends_excmd(*arg)) {
// ":let var1 var2"
- arg = (char_u *)list_arg_vars(eap, (const char *)arg, &first);
+ arg = (char *)list_arg_vars(eap, (const char *)arg, &first);
} else if (!eap->skip) {
// ":let"
list_glob_vars(&first);
@@ -1425,7 +1425,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
list_func_vars(&first);
list_vim_vars(&first);
}
- eap->nextcmd = check_nextcmd(arg);
+ eap->nextcmd = check_nextcmd((char_u *)arg);
} else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<') {
// HERE document
list_T *l = heredoc_get(eap, expr + 3);
@@ -1434,8 +1434,8 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
if (!eap->skip) {
op[0] = '=';
op[1] = NUL;
- (void)ex_let_vars(eap->arg, &rettv, false, semicolon, var_count,
- is_const, op);
+ (void)ex_let_vars((char *)eap->arg, &rettv, false, semicolon, var_count,
+ is_const, (char *)op);
}
tv_clear(&rettv);
}
@@ -1449,23 +1449,23 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
expr++;
}
}
- expr = skipwhite(expr + 2);
+ expr = (char *)skipwhite((char_u *)expr + 2);
} else {
- expr = skipwhite(expr + 1);
+ expr = (char *)skipwhite((char_u *)expr + 1);
}
if (eap->skip) {
++emsg_skip;
}
- i = eval0(expr, &rettv, &eap->nextcmd, !eap->skip);
+ i = eval0(expr, &rettv, (char **)&eap->nextcmd, !eap->skip);
if (eap->skip) {
if (i != FAIL) {
tv_clear(&rettv);
}
emsg_skip--;
} else if (i != FAIL) {
- (void)ex_let_vars(eap->arg, &rettv, false, semicolon, var_count,
- is_const, op);
+ (void)ex_let_vars((char *)eap->arg, &rettv, false, semicolon, var_count,
+ is_const, (char *)op);
tv_clear(&rettv);
}
}
@@ -1483,10 +1483,10 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
/// @param is_const lock variables for :const
///
/// @return OK or FAIL;
-static int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon, int var_count,
- int is_const, char_u *op)
+static int ex_let_vars(char *arg_start, typval_T *tv, int copy, int semicolon, int var_count,
+ int is_const, char *op)
{
- char_u *arg = arg_start;
+ char *arg = arg_start;
typval_T ltv;
if (*arg != '[') {
@@ -1522,16 +1522,15 @@ static int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon,
listitem_T *item = tv_list_first(l);
size_t rest_len = tv_list_len(l);
while (*arg != ']') {
- arg = skipwhite(arg + 1);
- arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), true, is_const,
- (const char_u *)",;]", op);
+ arg = (char *)skipwhite((char_u *)arg + 1);
+ arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), true, is_const, ",;]", op);
if (arg == NULL) {
return FAIL;
}
rest_len--;
item = TV_LIST_ITEM_NEXT(l, item);
- arg = skipwhite(arg);
+ arg = (char *)skipwhite((char_u *)arg);
if (*arg == ';') {
/* Put the rest of the list (may be empty) in the var after ';'.
* Create a new list for this. */
@@ -1546,8 +1545,7 @@ static int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon,
ltv.vval.v_list = rest_list;
tv_list_ref(rest_list);
- arg = ex_let_one(skipwhite(arg + 1), &ltv, false, is_const, (char_u *)"]",
- op);
+ arg = ex_let_one((char *)skipwhite((char_u *)arg + 1), &ltv, false, is_const, "]", op);
tv_clear(&ltv);
if (arg == NULL) {
return FAIL;
@@ -1568,24 +1566,24 @@ static int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon,
/// for "[var, var; var]" set "semicolon".
///
/// @return NULL for an error.
-static const char_u *skip_var_list(const char_u *arg, int *var_count, int *semicolon)
+static const char *skip_var_list(const char *arg, int *var_count, int *semicolon)
{
- const char_u *p;
- const char_u *s;
+ const char *p;
+ const char *s;
if (*arg == '[') {
// "[var, var]": find the matching ']'.
p = arg;
for (;;) {
- p = skipwhite(p + 1); // skip whites after '[', ';' or ','
- s = skip_var_one(p);
+ p = (char *)skipwhite((char_u *)p + 1); // skip whites after '[', ';' or ','
+ s = skip_var_one((char *)p);
if (s == p) {
semsg(_(e_invarg2), p);
return NULL;
}
++*var_count;
- p = skipwhite(s);
+ p = (char *)skipwhite((char_u *)s);
if (*p == ']') {
break;
} else if (*p == ';') {
@@ -1601,19 +1599,19 @@ static const char_u *skip_var_list(const char_u *arg, int *var_count, int *semic
}
return p + 1;
} else {
- return skip_var_one(arg);
+ return skip_var_one((char *)arg);
}
}
/// Skip one (assignable) variable name, including @r, $VAR, &option, d.key,
/// l[idx].
-static const char_u *skip_var_one(const char_u *arg)
+static const char *skip_var_one(const char *arg)
{
if (*arg == '@' && arg[1] != NUL) {
return arg + 2;
}
- return find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
- NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
+ return (char *)find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
+ NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
}
/// List variables for hashtab "ht" with prefix "prefix".
@@ -1696,8 +1694,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
while (!ends_excmd(*arg) && !got_int) {
if (error || eap->skip) {
- arg = (const char *)find_name_end((char_u *)arg, NULL, NULL,
-