aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDundar Goc <gocdundar@gmail.com>2022-05-03 11:06:27 +0200
committerDundar Goc <gocdundar@gmail.com>2022-05-04 15:25:54 +0200
commit5576d30e89153c817fb1a8d23c30cfc0432bc7c6 (patch)
tree3a1457be276d95ffccbb760e79c708ab11b2cd54 /src
parent3ec93ca92cb08faed342586e86a6f21b35264376 (diff)
downloadrneovim-5576d30e89153c817fb1a8d23c30cfc0432bc7c6.tar.gz
rneovim-5576d30e89153c817fb1a8d23c30cfc0432bc7c6.tar.bz2
rneovim-5576d30e89153c817fb1a8d23c30cfc0432bc7c6.zip
refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/autocmd.c4
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/api/vimscript.c2
-rw-r--r--src/nvim/autocmd.c12
-rw-r--r--src/nvim/buffer.c28
-rw-r--r--src/nvim/cursor_shape.c28
-rw-r--r--src/nvim/debugger.c8
-rw-r--r--src/nvim/diff.c26
-rw-r--r--src/nvim/edit.c2
-rw-r--r--src/nvim/eval.c46
-rw-r--r--src/nvim/eval/funcs.c13
-rw-r--r--src/nvim/eval/userfunc.c32
-rw-r--r--src/nvim/ex_cmds.c56
-rw-r--r--src/nvim/ex_cmds2.c46
-rw-r--r--src/nvim/ex_cmds_defs.h24
-rw-r--r--src/nvim/ex_docmd.c355
-rw-r--r--src/nvim/ex_eval.c59
-rw-r--r--src/nvim/ex_eval.h2
-rw-r--r--src/nvim/ex_getln.c88
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/hardcopy.c6
-rw-r--r--src/nvim/highlight_group.c15
-rw-r--r--src/nvim/if_cscope.c32
-rw-r--r--src/nvim/lua/executor.c2
-rw-r--r--src/nvim/main.c12
-rw-r--r--src/nvim/main.h6
-rw-r--r--src/nvim/mark.c10
-rw-r--r--src/nvim/mark_defs.h2
-rw-r--r--src/nvim/match.c10
-rw-r--r--src/nvim/menu.c10
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/move.c4
-rw-r--r--src/nvim/ops.c2
-rw-r--r--src/nvim/option.c21
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/quickfix.c34
-rw-r--r--src/nvim/runtime.c2
-rw-r--r--src/nvim/shada.c10
-rw-r--r--src/nvim/sign.c8
-rw-r--r--src/nvim/spellfile.c4
-rw-r--r--src/nvim/syntax.c86
41 files changed, 554 insertions, 561 deletions
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index 0db9a63e7a..2f4f57049e 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -474,7 +474,7 @@ Integer nvim_create_autocmd(uint64_t channel_id, Object event, Dict(create_autoc
Object *command = &opts->command;
if (command->type == kObjectTypeString) {
aucmd.type = CALLABLE_EX;
- aucmd.callable.cmd = (char_u *)string_to_cstr(command->data.string);
+ aucmd.callable.cmd = string_to_cstr(command->data.string);
} else {
api_set_error(err,
kErrorTypeValidation,
@@ -657,8 +657,6 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Error *err)
cleanup:
api_free_array(event_array);
api_free_array(patterns);
-
- return;
}
/// Create or get an autocommand group |autocmd-groups|.
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 3f0cfb82a6..2323b8db47 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -2210,7 +2210,7 @@ Array nvim_get_mark(String name, Dictionary opts, Error *err)
allocated = true;
// Marks comes from shada
} else {
- filename = (char *)mark.fname;
+ filename = mark.fname;
bufnr = 0;
}
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c
index 99d1406cfb..acd89119f9 100644
--- a/src/nvim/api/vimscript.c
+++ b/src/nvim/api/vimscript.c
@@ -827,7 +827,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
bool done = false;
while (!done) {
- done = uc_split_args_iter(ea.arg, length, &end, buf, &len);
+ done = uc_split_args_iter((char_u *)ea.arg, length, &end, buf, &len);
if (len > 0) {
ADD(args, STRING_OBJ(cstrn_to_string(buf, len)));
}
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index cd726b70b6..4f71149931 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -972,7 +972,7 @@ int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, char_u *
if (is_adding_cmd) {
AucmdExecutable exec = AUCMD_EXECUTABLE_INIT;
exec.type = CALLABLE_EX;
- exec.callable.cmd = cmd;
+ exec.callable.cmd = (char *)cmd;
autocmd_register(0, event, pat, patlen, group, once, nested, NULL, exec);
}
@@ -1240,7 +1240,7 @@ void ex_doautoall(exarg_T *eap)
{
int retval = OK;
aco_save_T aco;
- char_u *arg = eap->arg;
+ char_u *arg = (char_u *)eap->arg;
int call_do_modelines = check_nomodeline(&arg);
bufref_T bufref;
bool did_aucmd;
@@ -2142,7 +2142,7 @@ char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
// However, my expectation would be that could be expensive.
retval = vim_strsave((char_u *)"");
} else {
- retval = vim_strsave(ac->exec.callable.cmd);
+ retval = vim_strsave((char_u *)ac->exec.callable.cmd);
}
// Remove one-shot ("once") autocmd in anticipation of its execution.
@@ -2241,7 +2241,7 @@ char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd)
autocmd_include_groups = true;
}
xp->xp_context = EXPAND_EVENTS; // expand event name
- xp->xp_pattern = arg;
+ xp->xp_pattern = (char *)arg;
return NULL;
}
@@ -2501,7 +2501,7 @@ char *aucmd_exec_to_string(AutoCmd *ac, AucmdExecutable acc)
{
switch (acc.type) {
case CALLABLE_EX:
- return (char *)acc.callable.cmd;
+ return acc.callable.cmd;
case CALLABLE_CB:
return ac->desc;
case CALLABLE_NONE:
@@ -2534,7 +2534,7 @@ AucmdExecutable aucmd_exec_copy(AucmdExecutable src)
switch (src.type) {
case CALLABLE_EX:
dest.type = CALLABLE_EX;
- dest.callable.cmd = vim_strsave(src.callable.cmd);
+ dest.callable.cmd = xstrdup(src.callable.cmd);
return dest;
case CALLABLE_CB:
dest.type = CALLABLE_CB;
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 14ed9921a0..1ae1811772 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -2622,7 +2622,7 @@ void buflist_list(exarg_T *eap)
garray_T buflist;
buf_T **buflist_data = NULL;
- if (vim_strchr(eap->arg, 't')) {
+ if (vim_strchr((char_u *)eap->arg, 't')) {
ga_init(&buflist, sizeof(buf_T *), 50);
for (buf = firstbuf; buf != NULL; buf = buf->b_next) {
ga_grow(&buflist, 1);
@@ -2645,21 +2645,21 @@ void buflist_list(exarg_T *eap)
const bool job_running = buf->terminal && terminal_running(buf->terminal);
// skip unspecified buffers
- if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u'))
- || (vim_strchr(eap->arg, 'u') && buf->b_p_bl)
- || (vim_strchr(eap->arg, '+')
+ if ((!buf->b_p_bl && !eap->forceit && !vim_strchr((char_u *)eap->arg, 'u'))
+ || (vim_strchr((char_u *)eap->arg, 'u') && buf->b_p_bl)
+ || (vim_strchr((char_u *)eap->arg, '+')
&& ((buf->b_flags & BF_READERR) || !bufIsChanged(buf)))
- || (vim_strchr(eap->arg, 'a')
+ || (vim_strchr((char_u *)eap->arg, 'a')
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0))
- || (vim_strchr(eap->arg, 'h')
+ || (vim_strchr((char_u *)eap->arg, 'h')
&& (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0))
- || (vim_strchr(eap->arg, 'R') && (!is_terminal || !job_running))
- || (vim_strchr(eap->arg, 'F') && (!is_terminal || job_running))
- || (vim_strchr(eap->arg, '-') && buf->b_p_ma)
- || (vim_strchr(eap->arg, '=') && !buf->b_p_ro)
- || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR))
- || (vim_strchr(eap->arg, '%') && buf != curbuf)
- || (vim_strchr(eap->arg, '#')
+ || (vim_strchr((char_u *)eap->arg, 'R') && (!is_terminal || !job_running))
+ || (vim_strchr((char_u *)eap->arg, 'F') && (!is_terminal || job_running))
+ || (vim_strchr((char_u *)eap->arg, '-') && buf->b_p_ma)
+ || (vim_strchr((char_u *)eap->arg, '=') && !buf->b_p_ro)
+ || (vim_strchr((char_u *)eap->arg, 'x') && !(buf->b_flags & BF_READERR))
+ || (vim_strchr((char_u *)eap->arg, '%') && buf != curbuf)
+ || (vim_strchr((char_u *)eap->arg, '#')
&& (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) {
continue;
}
@@ -2700,7 +2700,7 @@ void buflist_list(exarg_T *eap)
do {
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
- if (vim_strchr(eap->arg, 't') && buf->b_last_used) {
+ if (vim_strchr((char_u *)eap->arg, 't') && buf->b_last_used) {
undo_fmt_time(IObuff + len, (size_t)(IOSIZE - len), buf->b_last_used);
} else {
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), _("line %" PRId64),
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 82c3a714b1..b092873a35 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -94,11 +94,11 @@ Array mode_style_array(void)
/// @returns error message for an illegal option, NULL otherwise.
char *parse_shape_opt(int what)
{
- char_u *colonp;
- char_u *commap;
- char_u *slashp;
- char_u *p = NULL;
- char_u *endp;
+ char *colonp;
+ char *commap;
+ char *slashp;
+ char *p = NULL;
+ char *endp;
int idx = 0; // init for GCC
int all_idx;
int len;
@@ -118,10 +118,10 @@ char *parse_shape_opt(int what)
}
}
// Repeat for all comma separated parts.
- char_u *modep = p_guicursor;
+ char *modep = (char *)p_guicursor;
while (modep != NULL && *modep != NUL) {
- colonp = vim_strchr(modep, ':');
- commap = vim_strchr(modep, ',');
+ colonp = (char *)vim_strchr((char_u *)modep, ':');
+ commap = (char *)vim_strchr((char_u *)modep, ',');
if (colonp == NULL || (commap != NULL && commap < colonp)) {
return N_("E545: Missing colon");
@@ -169,7 +169,7 @@ char *parse_shape_opt(int what)
for (p = colonp + 1; *p && *p != ',';) {
{
// First handle the ones with a number argument.
- i = *p;
+ i = (uint8_t)(*p);
len = 0;
if (STRNICMP(p, "ver", 3) == 0) {
len = 3;
@@ -187,7 +187,7 @@ char *parse_shape_opt(int what)
if (!ascii_isdigit(*p)) {
return N_("E548: digit expected");
}
- int n = getdigits_int(&p, false, 0);
+ int n = getdigits_int((char_u **)&p, false, 0);
if (len == 3) { // "ver" or "hor"
if (n == 0) {
return N_("E549: Illegal percentage");
@@ -215,7 +215,7 @@ char *parse_shape_opt(int what)
}
p += 5;
} else { // must be a highlight group name then
- endp = vim_strchr(p, '-');
+ endp = (char *)vim_strchr((char_u *)p, '-');
if (commap == NULL) { // last part
if (endp == NULL) {
endp = p + STRLEN(p); // find end of part
@@ -223,14 +223,14 @@ char *parse_shape_opt(int what)
} else if (endp > commap || endp == NULL) {
endp = commap;
}
- slashp = vim_strchr(p, '/');
+ slashp = (char *)vim_strchr((char_u *)p, '/');
if (slashp != NULL && slashp < endp) {
// "group/langmap_group"
- i = syn_check_group((char *)p, (size_t)(slashp - p));
+ i = syn_check_group(p, (size_t)(slashp - p));
p = slashp + 1;
}
if (round == 2) {
- shape_table[idx].id = syn_check_group((char *)p, (size_t)(endp - p));
+ shape_table[idx].id = syn_check_group(p, (size_t)(endp - p));
shape_table[idx].id_lm = shape_table[idx].id;
if (slashp != NULL && slashp < endp) {
shape_table[idx].id = i;
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index cf062cfbe8..96bc4db71e 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -366,7 +366,7 @@ void ex_debug(exarg_T *eap)
int debug_break_level_save = debug_break_level;
debug_break_level = 9999;
- do_cmdline_cmd((char *)eap->arg);
+ do_cmdline_cmd(eap->arg);
debug_break_level = debug_break_level_save;
}
@@ -563,7 +563,7 @@ void ex_breakadd(exarg_T *eap)
gap = &prof_ga;
}
- if (dbg_parsearg(eap->arg, gap) == OK) {
+ if (dbg_parsearg((char_u *)eap->arg, gap) == OK) {
struct debuggy *bp = &DEBUGGY(gap, gap->ga_len);
bp->dbg_forceit = eap->forceit;
@@ -618,7 +618,7 @@ void ex_breakdel(exarg_T *eap)
if (ascii_isdigit(*eap->arg)) {
// ":breakdel {nr}"
- int nr = atoi((char *)eap->arg);
+ int nr = atoi(eap->arg);
for (int i = 0; i < gap->ga_len; i++) {
if (DEBUGGY(gap, i).dbg_nr == nr) {
todel = i;
@@ -630,7 +630,7 @@ void ex_breakdel(exarg_T *eap)
del_all = true;
} else {
// ":breakdel {func|file|expr} [lnum] {name}"
- if (dbg_parsearg(eap->arg, gap) == FAIL) {
+ if (dbg_parsearg((char_u *)eap->arg, gap) == FAIL) {
return;
}
bp = &DEBUGGY(gap, gap->ga_len);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index cfb1c35817..52ae1bc819 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1186,9 +1186,9 @@ void ex_diffpatch(exarg_T *eap)
#ifdef UNIX
// Get the absolute path of the patchfile, changing directory below.
- fullname = FullName_save((char *)eap->arg, false);
+ fullname = FullName_save(eap->arg, false);
esc_name =
- vim_strsave_shellescape((fullname != NULL ? (char_u *)fullname : eap->arg), true, true);
+ vim_strsave_shellescape((char_u *)(fullname != NULL ? fullname : eap->arg), true, true);
#else
esc_name = vim_strsave_shellescape(eap->arg, true, true);
#endif
@@ -1219,7 +1219,7 @@ void ex_diffpatch(exarg_T *eap)
// Use 'patchexpr' to generate the new file.
#ifdef UNIX
eval_patch((char *)tmp_orig,
- (fullname != NULL ? fullname : (char *)eap->arg),
+ (fullname != NULL ? fullname : eap->arg),
(char *)tmp_new);
#else
eval_patch((char *)tmp_orig, (char *)eap->arg, (char *)tmp_new);
@@ -1268,7 +1268,7 @@ void ex_diffpatch(exarg_T *eap)
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL) {
// Pretend it was a ":split fname" command
eap->cmdidx = CMD_split;
- eap->arg = tmp_new;
+ eap->arg = (char *)tmp_new;
do_exedit(eap, old_curwin);
// check that split worked and editing tmp_new
@@ -1279,7 +1279,7 @@ void ex_diffpatch(exarg_T *eap)
if (newname != NULL) {
// do a ":file filename.new" on the patched buffer
- eap->arg = newname;
+ eap->arg = (char *)newname;
ex_file(eap);
// Do filetype detection with the new name.
@@ -2469,10 +2469,10 @@ void nv_diffgetput(bool put, size_t count)
return;
}
if (count == 0) {
- ea.arg = (char_u *)"";
+ ea.arg = "";
} else {
vim_snprintf(buf, sizeof(buf), "%zu", count);
- ea.arg = (char_u *)buf;
+ ea.arg = buf;
}
if (put) {
@@ -2553,18 +2553,18 @@ void ex_diffgetput(exarg_T *eap)
}
} else {
// Buffer number or pattern given. Ignore trailing white space.
- p = eap->arg + STRLEN(eap->arg);
- while (p > eap->arg && ascii_iswhite(p[-1])) {
+ p = (char_u *)eap->arg + STRLEN(eap->arg);
+ while (p > (char_u *)eap->arg && ascii_iswhite(p[-1])) {
p--;
}
- for (i = 0; ascii_isdigit(eap->arg[i]) && eap->arg + i < p; i++) {}
+ for (i = 0; ascii_isdigit(eap->arg[i]) && (char_u *)eap->arg + i < p; i++) {}
- if (eap->arg + i == p) {
+ if ((char_u *)eap->arg + i == p) {
// digits only
- i = (int)atol((char *)eap->arg);
+ i = (int)atol(eap->arg);
} else {
- i = buflist_findpat(eap->arg, p, false, true, false);
+ i = buflist_findpat((char_u *)eap->arg, p, false, true, false);
if (i < 0) {
// error message already given
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 6a6d433228..f17ac52f15 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -5278,7 +5278,7 @@ static int ins_complete(int c, bool enable_pum)
// "pattern not found" message.
compl_col = curs_col;
} else {
- compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
+ compl_col = (int)((char_u *)compl_xp.xp_pattern - compl_pattern);
}
compl_length = curs_col - compl_col;
} else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index b4c3e62ddf..7f99d81bb4 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1296,7 +1296,7 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
// 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 = (char *)(*eap->cmdlinep);
+ p = *eap->cmdlinep;
while (ascii_iswhite(*p)) {
p++;
marker_indent_len++;
@@ -1389,7 +1389,7 @@ void ex_let(exarg_T *eap)
static void ex_let_const(exarg_T *eap, const bool is_const)
{
- char *arg = (char *)eap->arg;
+ char *arg = eap->arg;
char *expr = NULL;
typval_T rettv;
int i;
@@ -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((char_u *)arg);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
} else if (expr[0] == '=' && expr[1] == '<' && expr[2] == '<') {
// HERE document
list_T *l = heredoc_get(eap, expr + 3);
@@ -1434,7 +1434,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
if (!eap->skip) {
op[0] = '=';
op[1] = NUL;
- (void)ex_let_vars((char *)eap->arg, &rettv, false, semicolon, var_count,
+ (void)ex_let_vars(eap->arg, &rettv, false, semicolon, var_count,
is_const, (char *)op);
}
tv_clear(&rettv);
@@ -1457,14 +1457,14 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
if (eap->skip) {
++emsg_skip;
}
- i = eval0(expr, &rettv, (char **)&eap->nextcmd, !eap->skip);
+ i = eval0(expr, &rettv, &eap->nextcmd, !eap->skip);
if (eap->skip) {
if (i != FAIL) {
tv_clear(&rettv);
}
emsg_skip--;
} else if (i != FAIL) {
- (void)ex_let_vars((char *)eap->arg, &rettv, false, semicolon, var_count,
+ (void)ex_let_vars(eap->arg, &rettv, false, semicolon, var_count,
is_const, (char *)op);
tv_clear(&rettv);
}
@@ -2715,7 +2715,7 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
if (strpbrk(arg, "\"'+-*/%.=!?~|&$([<>,#") == NULL) {
// ":let var1 var2 ...": find last space.
for (p = arg + STRLEN(arg); p >= arg;) {
- xp->xp_pattern = (char_u *)p;
+ xp->xp_pattern = p;
MB_PTR_BACK(arg, p);
if (ascii_iswhite(*p)) {
break;
@@ -2727,10 +2727,10 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
xp->xp_context = cmdidx == CMD_call ? EXPAND_FUNCTIONS
: EXPAND_EXPRESSION;
}
- while ((xp->xp_pattern = (char_u *)strpbrk(arg, "\"'+-*/%.=!?~|&$([<>,#")) != NULL) {
- c = *xp->xp_pattern;
+ while ((xp->xp_pattern = strpbrk(arg, "\"'+-*/%.=!?~|&$([<>,#")) != NULL) {
+ c = (uint8_t)(*xp->xp_pattern);
if (c == '&') {
- c = xp->xp_pattern[1];
+ c = (uint8_t)xp->xp_pattern[1];
if (c == '&') {
++xp->xp_pattern;
xp->xp_context = cmdidx != CMD_let || got_eq
@@ -2753,12 +2753,12 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
break;
} else if ((c == '<' || c == '#')
&& xp->xp_context == EXPAND_FUNCTIONS
- && vim_strchr(xp->xp_pattern, '(') == NULL) {
+ && vim_strchr((char_u *)xp->xp_pattern, '(') == NULL) {
// Function name can start with "<SNR>" and contain '#'.
break;
} else if (cmdidx != CMD_let || got_eq) {
if (c == '"') { // string
- while ((c = *++xp->xp_pattern) != NUL && c != '"') {
+ while ((c = (uint8_t)(*++xp->xp_pattern)) != NUL && c != '"') {
if (c == '\\' && xp->xp_pattern[1] != NUL) {
xp->xp_pattern++;
}
@@ -2766,7 +2766,7 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
xp->xp_context = EXPAND_NOTHING;
} else if (c == '\'') { // literal string
// Trick: '' is like stopping and starting a literal string.
- while ((c = *++xp->xp_pattern) != NUL && c != '\'') {}
+ while ((c = (uint8_t)(*++xp->xp_pattern)) != NUL && c != '\'') {}
xp->xp_context = EXPAND_NOTHING;
} else if (c == '|') {
if (xp->xp_pattern[1] == '|') {
@@ -2783,7 +2783,7 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
// anyway.
xp->xp_context = EXPAND_EXPRESSION;
}
- arg = (char *)xp->xp_pattern;
+ arg = xp->xp_pattern;
if (*arg != NUL) {
while ((c = (char_u)(*++arg)) != NUL && (c == ' ' || c == '\t')) {}
}
@@ -2805,13 +2805,13 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
}
}
- xp->xp_pattern = (char_u *)arg;
+ xp->xp_pattern = arg;
}
/// ":unlet[!] var1 ... " command.
void ex_unlet(exarg_T *eap)
{
- ex_unletlock(eap, (char *)eap->arg, 0, do_unlet_var);
+ ex_unletlock(eap, eap->arg, 0, do_unlet_var);
}
// TODO(ZyX-I): move to eval/ex_cmds
@@ -2819,7 +2819,7 @@ void ex_unlet(exarg_T *eap)
/// ":lockvar" and ":unlockvar" commands
void ex_lockvar(exarg_T *eap)
{
- char *arg = (char *)eap->arg;
+ char *arg = eap->arg;
int deep = 2;
if (eap->forceit) {
@@ -2894,7 +2894,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
arg = (char *)skipwhite((char_u *)name_end);
} while (!ends_excmd(*arg));
- eap->nextcmd = check_nextcmd((char_u *)arg);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
}
// TODO(ZyX-I): move to eval/ex_cmds
@@ -9422,7 +9422,7 @@ int var_item_copy(const vimconv_T *const conv, typval_T *const from, typval_T *c
/// ":echon expr1 ..." print each argument plain.
void ex_echo(exarg_T *eap)
{
- char *arg = (char *)eap->arg;
+ char *arg = eap->arg;
typval_T rettv;
bool atstart = true;
bool need_clear = true;
@@ -9478,7 +9478,7 @@ void ex_echo(exarg_T *eap)
tv_clear(&rettv);
arg = (char *)skipwhite((char_u *)arg);
}
- eap->nextcmd = check_nextcmd((char_u *)arg);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
if (eap->skip) {
emsg_skip--;
@@ -9496,7 +9496,7 @@ void ex_echo(exarg_T *eap)
/// ":echohl {name}".
void ex_echohl(exarg_T *eap)
{
- echo_attr = syn_name2attr(eap->arg);
+ echo_attr = syn_name2attr((char_u *)eap->arg);
}
/// ":execute expr1 ..." execute the result of an expression.
@@ -9506,7 +9506,7 @@ void ex_echohl(exarg_T *eap)
/// echo commands
void ex_execute(exarg_T *eap)
{
- char *arg = (char *)eap->arg;
+ char *arg = eap->arg;
typval_T rettv;
int ret = OK;
garray_T ga;
@@ -9576,7 +9576,7 @@ void ex_execute(exarg_T *eap)
--emsg_skip;
}
- eap->nextcmd = check_nextcmd((char_u *)arg);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
}
/// Skip over the name of an option: "&option", "&g:option" or "&l:option".
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 0a71526246..4aae070530 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2194,7 +2194,7 @@ static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
exarg_T eap = {
.cmd = (char *)cmdstr,
- .arg = cmdstr,
+ .arg = (char *)cmdstr,
.usefilter = false,
.nextcmd = NULL,
.cmdidx = CMD_USER,
@@ -3246,7 +3246,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
ExpandInit(&xpc);
- xpc.xp_pattern = (char_u *)pattern;
+ xpc.xp_pattern = (char *)pattern;
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(type);
if (xpc.xp_context == EXPAND_NOTHING) {
@@ -3255,7 +3255,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (xpc.xp_context == EXPAND_MENUS) {
- set_context_in_menu_cmd(&xpc, "menu", (char *)xpc.xp_pattern, false);
+ set_context_in_menu_cmd(&xpc, "menu", xpc.xp_pattern, false);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}
@@ -3265,12 +3265,12 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (xpc.xp_context == EXPAND_SIGN) {
- set_context_in_sign_cmd(&xpc, xpc.xp_pattern);
+ set_context_in_sign_cmd(&xpc, (char_u *)xpc.xp_pattern);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}
theend:
- pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
+ pat = addstar((char_u *)xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP);
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
@@ -3528,7 +3528,7 @@ static void f_getjumplist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_dict_add_nr(d, S_LEN("coladd"), wp->w_jumplist[i].fmark.mark.coladd);
tv_dict_add_nr(d, S_LEN("bufnr"), wp->w_jumplist[i].fmark.fnum);
if (wp->w_jumplist[i].fname != NULL) {
- tv_dict_add_str(d, S_LEN("filename"), (char *)wp->w_jumplist[i].fname);
+ tv_dict_add_str(d, S_LEN("filename"), wp->w_jumplist[i].fname);
}
}
}
@@ -10994,7 +10994,6 @@ static void f_tr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
error:
semsg(_(e_invarg2), fromstr);
ga_clear(&ga);
- return;
}
/// "trim({expr})" function
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 0a35e6655f..fe8325760c 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -1953,7 +1953,7 @@ void ex_function(exarg_T *eap)
}
}
}
- eap->nextcmd = check_nextcmd(eap->arg);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)eap->arg);
return;
}
@@ -1961,13 +1961,13 @@ void ex_function(exarg_T *eap)
* ":function /pat": list functions matching pattern.
*/
if (*eap->arg == '/') {
- p = skip_regexp(eap->arg + 1, '/', TRUE, NULL);
+ p = skip_regexp((char_u *)eap->arg + 1, '/', true, NULL);
if (!eap->skip) {
regmatch_T regmatch;
c = *p;