diff options
author | Dundar Goc <gocdundar@gmail.com> | 2022-05-03 11:06:27 +0200 |
---|---|---|
committer | Dundar Goc <gocdundar@gmail.com> | 2022-05-04 15:25:54 +0200 |
commit | 5576d30e89153c817fb1a8d23c30cfc0432bc7c6 (patch) | |
tree | 3a1457be276d95ffccbb760e79c708ab11b2cd54 | |
parent | 3ec93ca92cb08faed342586e86a6f21b35264376 (diff) | |
download | rneovim-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
42 files changed, 555 insertions, 562 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 8e2bc1f036..d4477df803 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1819,7 +1819,7 @@ nvim_parse_cmd({str}, {opts}) *nvim_parse_cmd()* • lockmarks: (boolean) |:lockmarks|. • noswapfile: (boolean) |:noswapfile|. • tab: (integer) |:tab|. - • verbose: (integer) |:verbose|. + • verbose: (integer) |:verbose|. -1 when omitted. • vertical: (boolean) |:vertical|. • split: (string) Split modifier string, is an empty string when there's no split modifier. If there is a 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; *p = NUL; - regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); + regmatch.regprog = vim_regcomp((char_u *)eap->arg + 1, RE_MAGIC); *p = c; if (regmatch.regprog != NULL) { regmatch.rm_ic = p_ic; @@ -1989,7 +1989,7 @@ void ex_function(exarg_T *eap) if (*p == '/') { ++p; } - eap->nextcmd = check_nextcmd(p); + eap->nextcmd = (char *)check_nextcmd(p); return; } @@ -2007,7 +2007,7 @@ void ex_function(exarg_T *eap) // "fudi.fd_di" set, "fudi.fd_newkey" == NULL // s:func script-local function name // g:func global function name, same as "func" - p = eap->arg; + p = (char_u *)eap->arg; name = trans_function_name(&p, eap->skip, TFN_NO_AUTOLOAD, &fudi, NULL); paren = (vim_strchr(p, '(') != NULL); if (name == NULL && (fudi.fd_dict == NULL || !paren) && !eap->skip) { @@ -2043,7 +2043,7 @@ void ex_function(exarg_T *eap) emsg(_(e_trailing)); goto ret_free; } - eap->nextcmd = check_nextcmd(p); + eap->nextcmd = (char *)check_nextcmd(p); if (eap->nextcmd != NULL) { *p = NUL; } @@ -2289,10 +2289,10 @@ void ex_function(exarg_T *eap) // Another command follows. If the line came from "eap" we // can simply point into it, otherwise we need to change // "eap->cmdlinep". - eap->nextcmd = nextcmd; + eap->nextcmd = (char *)nextcmd; if (line_to_free != NULL) { xfree(*eap->cmdlinep); - *eap->cmdlinep = line_to_free; + *eap->cmdlinep = (char *)line_to_free; line_to_free = NULL; } } @@ -2693,7 +2693,7 @@ void ex_delfunction(exarg_T *eap) char_u *name; funcdict_T fudi; - p = eap->arg; + p = (char_u *)eap->arg; name = trans_function_name(&p, eap->skip, 0, &fudi, NULL); xfree(fudi.fd_newkey); if (name == NULL) { @@ -2707,7 +2707,7 @@ void ex_delfunction(exarg_T *eap) emsg(_(e_trailing)); return; } - eap->nextcmd = check_nextcmd(p); + eap->nextcmd = (char *)check_nextcmd(p); if (eap->nextcmd != NULL) { *p = NUL; } @@ -2858,7 +2858,7 @@ static int can_free_funccal(funccall_T *fc, int copyID) /// ":return [expr]" void ex_return(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; typval_T rettv; int returning = FALSE; @@ -2873,7 +2873,7 @@ void ex_return(exarg_T *eap) eap->nextcmd = NULL; if ((*arg != NUL && *arg != '|' && *arg != '\n') - && eval0((char *)arg, &rettv, (char **)&eap->nextcmd, !eap->skip) != FAIL) { + && eval0((char *)arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) { if (!eap->skip) { returning = do_return(eap, false, true, &rettv); } else { @@ -2896,7 +2896,7 @@ void ex_return(exarg_T *eap) if (returning) { eap->nextcmd = NULL; } else if (eap->nextcmd == NULL) { // no argument - eap->nextcmd = check_nextcmd(arg); + eap->nextcmd = (char *)check_nextcmd(arg); } if (eap->skip) { @@ -2909,7 +2909,7 @@ void ex_return(exarg_T *eap) /// ":1,25call func(arg1, arg2)" function call. void ex_call(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *startarg; char_u *name; char_u *tofree; @@ -2926,7 +2926,7 @@ void ex_call(exarg_T *eap) // instead to skip to any following command, e.g. for: // :if 0 | call dict.foo().bar() | endif. emsg_skip++; - if (eval0((char *)eap->arg, &rettv, (char **)&eap->nextcmd, false) != FAIL) { + if (eval0(eap->arg, &rettv, &eap->nextcmd, false) != FAIL) { tv_clear(&rettv); } emsg_skip--; @@ -3025,7 +3025,7 @@ void ex_call(exarg_T *eap) emsg(_(e_trailing)); } } else { - eap->nextcmd = check_nextcmd(arg); + eap->nextcmd = (char *)check_nextcmd(arg); } } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 06fa981ba7..855e500b12 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -245,7 +245,7 @@ void ex_align(exarg_T *eap) } } - width = atoi((char *)eap->arg); + width = atoi(eap->arg); save_curpos = curwin->w_cursor; if (eap->cmdidx == CMD_left) { // width is used for new indent if (width >= 0) { @@ -484,7 +484,7 @@ void ex_sort(exarg_T *eap) size_t format_found = 0; bool change_occurred = false; // Buffer contents changed. - for (p = (char *)eap->arg; *p != NUL; p++) { + for (p = eap->arg; *p != NUL; p++) { if (ascii_iswhite(*p)) { // Skip } else if (*p == 'i') { @@ -514,7 +514,7 @@ void ex_sort(exarg_T *eap) // comment start break; } else if (check_nextcmd((char_u *)p) != NULL) { - eap->nextcmd = check_nextcmd((char_u *)p); + eap->nextcmd = (char *)check_nextcmd((char_u *)p); break; } else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) { s = (char *)skip_regexp((char_u *)p + 1, *p, true, NULL); @@ -746,8 +746,8 @@ void ex_retab(exarg_T *eap) save_list = curwin->w_p_list; curwin->w_p_list = 0; // don't want list mode here - new_ts_str = (char *)eap->arg; - if (!tabstop_set(eap->arg, &new_vts_array)) { + new_ts_str = eap->arg; + if (!tabstop_set((char_u *)eap->arg, &new_vts_array)) { return; } while (ascii_isdigit(*(eap->arg)) || *(eap->arg) == ',') { @@ -761,7 +761,7 @@ void ex_retab(exarg_T *eap) new_vts_array = curbuf->b_p_vts_array; new_ts_str = NULL; } else { - new_ts_str = xstrnsave(new_ts_str, eap->arg - (char_u *)new_ts_str); + new_ts_str = xstrnsave(new_ts_str, eap->arg - new_ts_str); } for (lnum = eap->line1; !got_int && lnum <= eap->line2; lnum++) { ptr = (char *)ml_get(lnum); @@ -1129,7 +1129,7 @@ void free_prev_shellcmd(void) void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out) FUNC_ATTR_NONNULL_ALL { - char *arg = (char *)eap->arg; // command + char *arg = eap->arg; // command linenr_T line1 = eap->line1; // start of range linenr_T line2 = eap->line2; // end of range char *newcmd = NULL; // the new command @@ -1755,7 +1755,7 @@ void ex_file(exarg_T *eap) } if (*eap->arg != NUL || eap->addr_count == 1) { - if (rename_buffer((char *)eap->arg) == FAIL) { + if (rename_buffer(eap->arg) == FAIL) { return; } redraw_tabline = true; @@ -1811,7 +1811,7 @@ int do_write(exarg_T *eap) return FAIL; } - ffname = (char *)eap->arg; + ffname = eap->arg; if (*ffname == NUL) { if (eap->cmdidx == CMD_saveas) { emsg(_(e_argreq)); @@ -2307,7 +2307,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so; if (eap != NULL) { - command = (char *)eap->do_ecmd_cmd; + command = eap->do_ecmd_cmd; } set_bufref(&old_curbuf, curbuf); @@ -2961,15 +2961,15 @@ void ex_append(exarg_T *eap) if (eap->nextcmd == NULL || *eap->nextcmd == NUL) { break; } - p = (char *)vim_strchr(eap->nextcmd, NL); + p = (char *)vim_strchr((char_u *)eap->nextcmd, NL); if (p == NULL) { - p = (char *)eap->nextcmd + STRLEN(eap->nextcmd); + p = eap->nextcmd + STRLEN(eap->nextcmd); } - theline = (char *)vim_strnsave(eap->nextcmd, (char_u *)p - eap->nextcmd); + theline = xstrnsave(eap->nextcmd, p - eap->nextcmd); if (*p != NUL) { p++; } - eap->nextcmd = (char_u *)p; + eap->nextcmd = p; } else { // Set State to avoid the cursor shape to be set to INSERT mode // when getline() returns. @@ -3105,7 +3105,7 @@ void ex_z(exarg_T *eap) bigness = 1; } - x = (char *)eap->arg; + x = eap->arg; kind = x; if (*kind == '-' || *kind == '+' || *kind == '=' || *kind == '^' || *kind == '.') { @@ -3463,7 +3463,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle bool got_quit = false; bool got_match = false; int which_pat; - char *cmd = (char *)eap->arg; + char *cmd = eap->arg; linenr_T first_line = 0; // first changed line linenr_T last_line= 0; // below last changed line AFTER the change linenr_T old_line_count = curbuf->b_ml.ml_line_count; @@ -3519,7 +3519,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle which_pat = RE_LAST; // use last used regexp delimiter = (char_u)(*cmd++); // remember delimiter character pat = cmd; // remember start of search pat - cmd = (char *)skip_regexp((char_u *)cmd, delimiter, p_magic, &eap->arg); + cmd = (char *)skip_regexp((char_u *)cmd, delimiter, p_magic, (char_u **)&eap->arg); if (cmd[0] == delimiter) { // end delimiter found *cmd++ = NUL; // replace it with a NUL has_second_delim = true; @@ -3592,7 +3592,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle */ cmd = (char *)skipwhite((char_u *)cmd); if (*cmd && *cmd != '"') { // if not end-of-line or comment - eap->nextcmd = check_nextcmd((char_u *)cmd); + eap->nextcmd = (char *)check_nextcmd((char_u *)cmd); if (eap->nextcmd == NULL) { emsg(_(e_trailing)); return NULL; @@ -4570,7 +4570,7 @@ void ex_global(exarg_T *eap) } else { type = (uint8_t)(*eap->cmd); } - cmd = (char *)eap->arg; + cmd = eap->arg; which_pat = RE_LAST; // default: use last used regexp /* @@ -4600,7 +4600,7 @@ void ex_global(exarg_T *eap) delim = *cmd; // get the delimiter cmd++; // skip delimiter if there is one pat = cmd; // remember start of pattern - cmd = (char *)skip_regexp((char_u *)cmd, delim, p_magic, &eap->arg); + cmd = (char *)skip_regexp((char_u *)cmd, delim, p_magic, (char_u **)&eap->arg); if (cmd[0] == delim) { // end delimiter found *cmd++ = NUL; // replace it with a NUL } @@ -4776,15 +4776,15 @@ void ex_help(exarg_T *eap) * A ":help" command ends at the first LF, or at a '|' that is * followed by some text. Set nextcmd to the following command. */ - for (arg = (char *)eap->arg; *arg; arg++) { + for (arg = eap->arg; *arg; arg++) { if (*arg == '\n' || *arg == '\r' || (*arg == '|' && arg[1] != NUL && arg[1] != '|')) { *arg++ = NUL; - eap->nextcmd = (char_u *)arg; + eap->nextcmd = arg; break; } } - arg = (char *)eap->arg; + arg = eap->arg; if (eap->forceit && *arg == NUL && !curbuf->b_help) { emsg(_("E478: Don't panic!")); @@ -5835,7 +5835,7 @@ void ex_helptags(exarg_T *eap) // Check for ":helptags ++t {dir}". if (STRNCMP(eap->arg, "++t", 3) == 0 && ascii_iswhite(eap->arg[3])) { add_help_tags = true; - eap->arg = skipwhite(eap->arg + 3); + eap->arg = (char *)skipwhite((char_u *)eap->arg + 3); } if (STRCMP(eap->arg, "ALL") == 0) { @@ -5843,7 +5843,7 @@ void ex_helptags(exarg_T *eap) } else { ExpandInit(&xpc); xpc.xp_context = EXPAND_DIRECTORIES; - dirname = (char *)ExpandOne(&xpc, eap->arg, NULL, + dirname = (char *)ExpandOne(&xpc, (char_u *)eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); if (dirname == NULL || !os_isdir((char_u *)dirname)) { semsg(_("E150: Not a directory: %s"), eap->arg); @@ -6060,7 +6060,7 @@ void ex_substitute(exarg_T *eap) block_autocmds(); // Disable events during command preview. - char *save_eap = (char *)eap->arg; + char *save_eap = eap->arg; garray_T save_view; win_size_save(&save_view); // Save current window sizes. save_search_patterns(); @@ -6101,7 +6101,7 @@ void ex_substitute(exarg_T *eap) curbuf->b_p_ul = save_b_p_ul; curwin->w_p_cul = save_w_p_cul; // Restore 'cursorline' curwin->w_p_cuc = save_w_p_cuc; // Restore 'cursorcolumn' - eap->arg = (char_u *)save_eap; + eap->arg = save_eap; restore_search_patterns(); win_size_restore(&save_view); ga_clear(&save_view); @@ -6204,7 +6204,7 @@ void ex_oldfiles(exarg_T *eap) return; } char *const s = (char *)expand_env_save((char_u *)p); - eap->arg = (char_u *)s; + eap->arg = s; eap->cmdidx = CMD_edit; cmdmod.browse = false; do_exedit(eap, NULL); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index edbd850cd0..e2664e427c 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -100,8 +100,8 @@ void ex_profile(exarg_T *eap) char_u *e; int len; - e = skiptowhite(eap->arg); - len = (int)(e - eap->arg); + e = skiptowhite((char_u *)eap->arg); + len = (int)(e - (char_u *)eap->arg); e = skipwhite(e); if (len == 5 && STRNCMP(eap->arg, "start", 5) == 0 && *e != NUL) { @@ -218,7 +218,7 @@ void set_context_in_profile_cmd(expand_T *xp, const char *arg) // Default: expand subcommands. xp->xp_context = EXPAND_PROFILE; pexpand_what = PEXP_SUBCMD; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; char_u *const end_subcmd = skiptowhite((const char_u *)arg); if (*end_subcmd == NUL) { @@ -227,7 +227,7 @@ void set_context_in_profile_cmd(expand_T *xp, const char *arg) if ((const char *)end_subcmd - arg == 5 && strncmp(arg, "start", 5) == 0) { xp->xp_context = EXPAND_FILES; - xp->xp_pattern = skipwhite((const char_u *)end_subcmd); + xp->xp_pattern = (char *)skipwhite((const char_u *)end_subcmd); return; } @@ -1191,7 +1191,7 @@ void ex_next(exarg_T *eap) | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) { if (*eap->arg != NUL) { // redefine file list - if (do_arglist(eap->arg, AL_SET, 0, true) == FAIL) { + if (do_arglist((char_u *)eap->arg, AL_SET, 0, true) == FAIL) { return; } i = 0; @@ -1209,7 +1209,7 @@ void ex_argedit(exarg_T *eap) // Whether curbuf will be reused, curbuf->b_ffname will be set. bool curbuf_is_reusable = curbuf_reusable(); - if (do_arglist(eap->arg, AL_ADD, i, true) == FAIL) { + if (do_arglist((char_u *)eap->arg, AL_ADD, i, true) == FAIL) { return; } maketitle(); @@ -1228,7 +1228,7 @@ void ex_argedit(exarg_T *eap) /// ":argadd" void ex_argadd(exarg_T *eap) { - do_arglist(eap->arg, AL_ADD, + do_arglist((char_u *)eap->arg, AL_ADD, eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1, false); maketitle(); @@ -1277,7 +1277,7 @@ void ex_argdelete(exarg_T *eap) } } } else { - do_arglist(eap->arg, AL_DEL, 0, false); + do_arglist((char_u *)eap->arg, AL_DEL, 0, false); } maketitle(); } @@ -1427,7 +1427,7 @@ void ex_listdo(exarg_T *eap) i++; // execute the command if (execute) { - do_cmdline((char *)eap->arg, eap->getline, eap->cookie, DOCMD_VERBOSE + DOCMD_NOWAIT); + do_cmdline(eap->arg, eap->getline, eap->cookie, DOCMD_VERBOSE + DOCMD_NOWAIT); } if (eap->cmdidx == CMD_bufdo) { @@ -1657,7 +1657,7 @@ void ex_options(exarg_T *eap) /// ":source [{fname}]" void ex_source(exarg_T *eap) { - cmd_source(eap->arg, eap); + cmd_source((char_u *)eap->arg, eap); } static void cmd_source(char_u *fname, exarg_T *eap) @@ -2207,7 +2207,7 @@ void ex_scriptnames(exarg_T *eap) if (eap->line2 < 1 || eap->line2 > script_items.ga_len) { emsg(_(e_invarg)); } else { - eap->arg = SCRIPT_ITEM(eap->line2).sn_name; + eap->arg = (char *)SCRIPT_ITEM(eap->line2).sn_name; do_exedit(eap, NULL); } return; @@ -2575,16 +2575,16 @@ void ex_scriptencoding(exarg_T *eap) } if (*eap->arg != NUL) { - name = enc_canonize(eap->arg); + name = enc_canonize((char_u *)eap->arg); } else { - name = eap->arg; + name = (char_u *)eap->arg; } // Setup for conversion from the specified encoding to 'encoding'. sp = (struct source_cookie *)getline_cookie(eap->getline, eap->cookie); convert_setup(&sp->conv, name, p_enc); - if (name != eap->arg) { + if (name != (char_u *)eap->arg) { xfree(name); } } @@ -2786,26 +2786,26 @@ void ex_language(exarg_T *eap) # define VIM_LC_MESSAGES 6789 # endif - name = eap->arg; + name = (char_u *)eap->arg; // Check for "messages {name}", "ctype {name}" or "time {name}" argument. // Allow abbreviation, but require at least 3 characters to avoid // confusion with a two letter language name "me" or "ct". - p = skiptowhite(eap->arg); - if ((*p == NUL || ascii_iswhite(*p)) && p - eap->arg >= 3) { - if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { + p = skiptowhite((char_u *)eap->arg); + if ((*p == NUL || ascii_iswhite(*p)) && p - (char_u *)eap->arg >= 3) { + if (STRNICMP(eap->arg, "messages", p - (char_u *)eap->arg) == 0) { what = VIM_LC_MESSAGES; name = skipwhite(p); whatstr = "messages "; - } else if (STRNICMP(eap->arg, "ctype", p - eap->arg) == 0) { + } else if (STRNICMP(eap->arg, "ctype", p - (char_u *)eap->arg) == 0) { what = LC_CTYPE; name = skipwhite(p); whatstr = "ctype "; - } else if (STRNICMP(eap->arg, "time", p - eap->arg) == 0) { + } else if (STRNICMP(eap->arg, "time", p - (char_u *)eap->arg) == 0) { what = LC_TIME; name = skipwhite(p); whatstr = "time "; - } else if (STRNICMP(eap->arg, "collate", p - eap->arg) == 0) { + } else if (STRNICMP(eap->arg, "collate", p - (char_u *)eap->arg) == 0) { what = LC_COLLATE; name = skipwhite(p); whatstr = "collate "; @@ -2999,7 +2999,7 @@ static void script_host_execute_file(char *name, exarg_T *eap) { if (!eap->skip) { uint8_t buffer[MAXPATHL]; - vim_FullName((char *)eap->arg, (char *)buffer, sizeof(buffer), false); + vim_FullName(eap->arg, (char *)buffer, sizeof(buffer), false); list_T *args = tv_list_alloc(3); // filename @@ -3036,7 +3036,7 @@ void ex_drop(exarg_T *eap) // and mostly only one file is dropped. // This also ignores wildcards, since it is very unlikely the user is // editing a file name with a wildcard character. - do_arglist(eap->arg, AL_SET, 0, false); + do_arglist((char_u *)eap->arg, AL_SET, 0, false); // Expanding wildcards may result in an empty argument list. E.g. when // editing "foo.pyc" and ".pyc" is in 'wildignore'. Assume that we diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h index f3b3e094f5..7d1ca316a1 100644 --- a/src/nvim/ex_cmds_defs.h +++ b/src/nvim/ex_cmds_defs.h @@ -114,7 +114,7 @@ typedef struct aucmd_executable_t AucmdExecutable; struct aucmd_executable_t { AucmdExecutableType type; union { - char_u *cmd; + char *cmd; Callback cb; } callable; }; @@ -174,10 +174,10 @@ enum { /// Arguments used for Ex commands. struct exarg { - char_u *arg; ///< argument of the command - char_u *nextcmd; ///< next command (NULL if none) - char *cmd; ///< the name of the command (except for :make) - char_u **cmdlinep; ///< pointer to pointer of allocated cmdline + char *arg; ///< argument of the command + char *nextcmd; ///< next command (NULL if none) + char *cmd; ///< the name of the command (except for :make) + char **cmdlinep; ///< pointer to pointer of allocated cmdline cmdidx_T cmdidx; ///< the index for the command uint32_t argt; ///< flags for the command int skip; ///< don't execute the command, only parse it @@ -187,7 +187,7 @@ struct exarg { linenr_T line2; ///< the second line number or count cmd_addr_T addr_type; ///< type of the count/range int flags; ///< extra flags after count: EXFLAG_ - char_u *do_ecmd_cmd; ///< +command arg to be used in edited file + char *do_ecmd_cmd; ///< +command arg to be used in edited file linenr_T do_ecmd_lnum; ///< the line number in an edited file int append; ///< TRUE with ":w >>file" command int usefilter; ///< TRUE with ":w !command" and ":r!command" @@ -201,7 +201,7 @@ struct exarg { int useridx; ///< user command index char *errmsg; ///< returned error message LineGetter getline; ///< Function used to get the next line - void *cookie; ///< argument for getline() + void *cookie; ///< argument for getline() cstack_T *cstack; ///< condition stack for ":if" etc. long verbose_save; ///< saved value of p_verbose int save_msg_silent; ///< saved value of msg_silent @@ -219,10 +219,10 @@ struct exarg { // used for completion on the command line struct expand { - char_u *xp_pattern; // start of item to expand + char *xp_pattern; // start of item to expand int xp_context; // type of expansion size_t xp_pattern_len; // bytes in xp_pattern before cursor - char_u *xp_arg; // completion function + char *xp_arg; // completion function LuaRef xp_luaref; // Ref to Lua completion function sctx_T xp_script_ctx; // SCTX for completion function int xp_backslash; // one of the XP_BS_ values @@ -232,8 +232,8 @@ struct expand { #endif int xp_numfiles; // number of files found by file name completion int xp_col; // cursor position in line - char_u **xp_files; // list of files - char_u *xp_line; // text being completed + char **xp_files; // list of files + char *xp_line; // text being completed }; // values for xp_backslash @@ -256,7 +256,7 @@ typedef struct { bool keeppatterns; ///< true when ":keeppatterns" was used bool lockmarks; ///< true when ":lockmarks" was used bool noswapfile; ///< true when ":noswapfile" was used - char_u *save_ei; ///< saved value of 'eventignore' + char *save_ei; ///< saved value of 'eventignore' regmatch_T filter_regmatch; ///< set by :filter /pat/ bool filter_force; ///< set for :filter! } cmdmod_T; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index e06dd7e59c..262e393468 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -348,7 +348,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags) emsg(_("E169: Command too recursive")); // When converting to an exception, we do not include the command name // since this is not an error of the specific command. - do_errthrow((cstack_T *)NULL, (char_u *)NULL); + do_errthrow((cstack_T *)NULL, NULL); msg_list = saved_msg_list; return FAIL; } @@ -558,7 +558,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags) * :endwhile/:endfor. */ if (current_line == lines_ga.ga_len - && (cstack.cs_looplevel || has_loop_cmd((char_u *)next_cmdline))) { + && (cstack.cs_looplevel || has_loop_cmd(next_cmdline))) { store_loop_line(&lines_ga, next_cmdline); } did_endif = false; @@ -797,8 +797,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags) // If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory // lack was reported above and the error message is to be converted to an // exception, do this now after rewinding the cstack. - do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line) - ? (char_u *)"endfunction" : (char_u *)NULL); + do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line) ? "endfunction" : NULL); if (trylevel == 0) { // When an exception is being thrown out of the outermost try @@ -835,7 +834,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags) saved_sourcing_name = (char *)sourcing_name; saved_sourcing_lnum = sourcing_lnum; - sourcing_name = current_exception->throw_name; + sourcing_name = (char_u *)current_exception->throw_name; sourcing_lnum = current_exception->throw_lnum; current_exception->throw_name = NULL; @@ -1308,15 +1307,15 @@ static void parse_register(exarg_T *eap) && !((eap->argt & EX_COUNT) && ascii_isdigit(*eap->arg))) { if (valid_yank_reg(*eap->arg, (eap->cmdidx != CMD_put && !IS_USER_CMDIDX(eap->cmdidx)))) { - eap->regname = *eap->arg++; + eap->regname = (uint8_t)(*eap->arg++); // for '=' register: accept the rest of the line as an expression if (eap->arg[-1] == '=' && eap->arg[0] != NUL) { if (!eap->skip) { - set_expr_line(vim_strsave(eap->arg)); + set_expr_line(vim_strsave((char_u *)eap->arg)); } eap->arg += STRLEN(eap->arg); } - eap->arg = skipwhite(eap->arg); + eap->arg = (char *)skipwhite((char_u *)eap->arg); } } } @@ -1329,10 +1328,10 @@ static int parse_count(exarg_T *eap, char **errormsg) long n; if ((eap->argt & EX_COUNT) && ascii_isdigit(*eap->arg) - && (!(eap->argt & EX_BUFNAME) || *(p = (char *)skipdigits(eap->arg + 1)) == NUL + && (!(eap->argt & EX_BUFNAME) || *(p = (char *)skipdigits((char_u *)eap->arg + 1)) == NUL || ascii_iswhite(*p))) { - n = getdigits_long(&eap->arg, false, -1); - eap->arg = skipwhite(eap->arg); + n = getdigits_long((char_u **)&eap->arg, false, -1); + eap->arg = (char *)skipwhite((char_u *)eap->arg); if (n <= 0 && (eap->argt & EX_ZEROR) == 0) { if (errormsg != NULL) { *errormsg = _(e_zerocount); @@ -1376,7 +1375,7 @@ bool parse_cmdline(char_u *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo) eap->line1 = 1; eap->line2 = 1; eap->cmd = (char *)cmdline; - eap->cmdlinep = &cmdline; + eap->cmdlinep = (char **)&cmdline; eap->getline = NULL; eap->cookie = NULL; @@ -1399,8 +1398,8 @@ bool parse_cmdline(char_u *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo) } if (cmdmod.save_ei != NULL) { cmdinfo->noautocmd = true; - set_string_option_direct("ei", -1, cmdmod.save_ei, OPT_FREE, SID_NONE); - free_string_option(cmdmod.save_ei); + set_string_option_direct("ei", -1, (char_u *)cmdmod.save_ei, OPT_FREE, SID_NONE); + free_string_option((char_u *)cmdmod.save_ei); } if (eap->verbose_save != -1) { cmdinfo->verbose = p_verbose; @@ -1454,9 +1453,9 @@ bool parse_cmdline(char_u *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo) // Skip to start of argument. // Don't do this for the ":!" command, because ":!! -l" needs the space. if (eap->cmdidx == CMD_bang) { - eap->arg = (char_u *)p; + eap->arg = p; } else { - eap->arg = skipwhite((char_u *)p); + eap->arg = (char *)skipwhite((char_u *)p); } // Don't treat ":r! filter" like a bang @@ -1492,7 +1491,7 @@ bool parse_cmdline(char_u *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo) // Remove leading whitespace and colon from next command if (eap->nextcmd) { - eap->nextcmd = (char_u *)skip_colon_white((char *)eap->nextcmd, true); + eap->nextcmd = skip_colon_white(eap->nextcmd, true); } // Set the "magic" values (characters that get treated specially) @@ -1568,7 +1567,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter // The "ea" structure holds the arguments that can be used. ea.cmd = *cmdlinep; - ea.cmdlinep = (char_u **)cmdlinep; + ea.cmdlinep = cmdlinep; ea.getline = fgetline; ea.cookie = cookie; ea.cstack = cstack; @@ -1671,7 +1670,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter * If we find a '|' or '\n' we set ea.nextcmd. */ if (*ea.cmd == NUL || *ea.cmd == '"' - || (ea.nextcmd = check_nextcmd((char_u *)ea.cmd)) != NULL) { + || (ea.nextcmd = (char *)check_nextcmd((char_u *)ea.cmd)) != NULL) { // strange vi behaviour: // ":3" jumps to line 3 // ":3|..." prints line 3 @@ -1867,9 +1866,9 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter * Don't do this for the ":!" command, because ":!! -l" needs the space. */ if (ea.cmdidx == CMD_bang) { - ea.arg = (char_u *)p; + ea.arg = p; } else { - ea.arg = skipwhite((char_u *)p); + ea.arg = (char *)skipwhite((char_u *)p); } // ":file" cannot be run with an argument when "curbuf->b_ro_locked" is set @@ -1896,8 +1895,8 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter errormsg = _("E494: Use w or w>>"); goto doend; } - ea.arg = skipwhite(ea.arg + 1); - ea.append = TRUE; + ea.arg = (char *)skipwhite((char_u *)ea.arg + 1); + ea.append = true; } else if (*ea.arg == '!' && ea.cmdidx == CMD_write) { // :w !filter ++ea.arg; ea.usefilter = TRUE; @@ -1916,11 +1915,11 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter if (ea.cmdidx == CMD_lshift || ea.cmdidx == CMD_rshift) { ea.amount = 1; - while (*ea.arg == (char_u)(*ea.cmd)) { // count number of '>' or '<' + while (*ea.arg == *ea.cmd) { // count number of '>' or '<' ea.arg++; ea.amount++; } - ea.arg = skipwhite(ea.arg); + ea.arg = (char *)skipwhite((char_u *)ea.arg); } /* @@ -1928,7 +1927,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter * Don't do this for ":read !cmd" and ":write !cmd". */ if ((ea.argt & EX_CMDARG) && !ea.usefilter) { - ea.do_ecmd_cmd = (char_u *)getargcmd((char **)&ea.arg); + ea.do_ecmd_cmd = getargcmd(&ea.arg); } /* @@ -1945,7 +1944,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter // Check for <newline> to end a shell command. // Also do this for ":read !cmd", ":write !cmd" and ":global". // Any others? - for (p = (char *)ea.arg; *p; p++) { + for (p = ea.arg; *p; p++) { // Remove one backslash before a newline, so that it's possible to // pass a newline to the shell and also a newline that is preceded // with a backslash. This makes it impossible to end a shell @@ -1955,7 +1954,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter if (*p == '\\' && p[1] == '\n') { STRMOVE(p, p + 1); } else if (*p == '\n') { - ea.nextcmd = (char_u *)p + 1; + ea.nextcmd = p + 1; *p = NUL; break; } @@ -2107,20 +2106,20 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter */ if (ea.cmdidx == CMD_bdelete || ea.cmdidx == CMD_bwipeout || ea.cmdidx == CMD_bunload) { - p = (char *)skiptowhite_esc(ea.arg); + p = (char *)skiptowhite_esc((char_u *)ea.arg); } else { - p = (char *)ea.arg + STRLEN(ea.arg); - while ((char_u *)p > ea.arg && ascii_iswhite(p[-1])) { + p = ea.arg + STRLEN(ea.arg); + while (p > ea.arg && ascii_iswhite(p[-1])) { p--; } } - ea.line2 = buflist_findpat(ea.arg, (char_u *)p, (ea.argt & EX_BUFUNL) != 0, + ea.line2 = buflist_findpat((char_u *)ea.arg, (char_u *)p, (ea.argt & EX_BUFUNL) != 0, false, false); if (ea.line2 < 0) { // failed goto doend; } ea.addr_count = 1; - ea.arg = skipwhite((char_u *)p); + ea.arg = (char *)skipwhite((char_u *)p); } // The :try command saves the emsg_silent flag, reset it here when @@ -2187,9 +2186,8 @@ doend: emsg(errormsg); } do_errthrow(cstack, - (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) - ? cmdnames[(int)ea.cmdidx].cmd_name - : (char_u *)NULL); + (ea.cmdidx != CMD_SIZE + && !IS_USER_CMDIDX(ea.cmdidx)) ? (char *)cmdnames[(int)ea.cmdidx].cmd_name : NULL); undo_cmdmod(&ea, save_msg_scroll); cmdmod = save_cmdmod; @@ -2206,7 +2204,7 @@ doend: --ex_nesting_level; - return (char *)ea.nextcmd; + return ea.nextcmd; } // NOLINT(readability/fn_size) static char ex_error_buf[MSG_BUF_LEN]; @@ -2382,9 +2380,8 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only) if (cmdmod.save_ei == NULL && !skip_only) { // Set 'eventignore' to "all". Restore the // existing option value later. - cmdmod.save_ei = vim_strsave(p_ei); - set_string_option_direct("ei", -1, - (char_u *)"all", OPT_FREE, SID_NONE); + cmdmod.save_ei = (char *)vim_strsave(p_ei); + set_string_option_direct("ei", -1, (char_u *)"all", OPT_FREE, SID_NONE); } continue; } @@ -2504,8 +2501,8 @@ static void undo_cmdmod(const exarg_T *eap, int save_msg_scroll) if (cmdmod.save_ei != NULL) { // Restore 'eventignore' to the value before ":noautocmd". - set_string_option_direct("ei", -1, cmdmod.save_ei, OPT_FREE, SID_NONE); - free_string_option(cmdmod.save_ei); + set_string_option_direct("ei", -1, (char_u *)cmdmod.save_ei, OPT_FREE, SID_NONE); + free_string_option((char_u *)cmdmod.save_ei); } vim_regfree(cmdmod.filter_regmatch.regprog); @@ -2943,7 +2940,7 @@ static char *find_ucmd(exarg_T *eap, char *p, int *full, expand_T *xp, int *comp } if (xp != NULL) { xp->xp_luaref = uc->uc_compl_luaref; - xp->xp_arg = uc->uc_compl_arg; + xp->xp_arg = (char *)uc->uc_compl_arg; xp->xp_script_ctx = uc->uc_script_ctx; xp->xp_script_ctx.sc_lnum += sourcing_lnum; } @@ -3123,15 +3120,15 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) bool usefilter = false; // Filter instead of file name. ExpandInit(xp); - xp->xp_pattern = (char_u *)buff; - xp->xp_line = (char_u *)buff; + xp->xp_pattern = (char *)buff; + xp->xp_line = (char *)buff; xp->xp_context = EXPAND_COMMANDS; // Default until we get past command ea.argt = 0; // 2. skip comment lines and leading space, colons or bars const char *cmd; for (cmd = buff; vim_strchr((const char_u *)" \t:|", *cmd) != NULL; cmd++) {} - xp->xp_pattern = (char_u *)cmd; + xp->xp_pattern = (char *)cmd; if (*cmd == NUL) { return NULL; @@ -3149,7 +3146,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) /* * 4. parse command */ - xp->xp_pattern = (char_u *)cmd; + xp->xp_pattern = (char *)cmd; if (*cmd == NUL) { return NULL; } @@ -3343,12 +3340,12 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) // Find start of last argument (argument just before cursor): p = buff; - xp->xp_pattern = (char_u *)p; + xp->xp_pattern = (char *)p; len = strlen(buff); while (*p && p < buff + len) { if (*p == ' ' || *p == TAB) { // Argument starts after a space. - xp->xp_pattern = (char_u *)++p; + xp->xp_pattern = (char *)++p; } else { if (*p == '\\' && *(p + 1) != NUL) { p++; // skip over escaped character @@ -3366,7 +3363,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) * Allow spaces within back-quotes to count as part of the argument * being expanded. */ - xp->xp_pattern = skipwhite((const char_u *)arg); + xp->xp_pattern = (char *)skipwhite((const char_u *)arg); p = (const char *)xp->xp_pattern; while (*p != NUL) { c = utf_ptr2char((const char_u *)p); @@ -3374,7 +3371,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) p++; } else if (c == '`') { if (!in_quote) { - xp->xp_pattern = (char_u *)p; + xp->xp_pattern = (char *)p; bow = p + 1; } in_quote = !in_quote; @@ -3397,7 +3394,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) if (in_quote) { bow = p; } else { - xp->xp_pattern = (char_u *)p; + xp->xp_pattern = (char *)p; } p -= len; } @@ -3409,7 +3406,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) * expand from there. */ if (bow != NULL && in_quote) { - xp->xp_pattern = (char_u *)bow; + xp->xp_pattern = (char *)bow; } xp->xp_context = EXPAND_FILES; @@ -3419,7 +3416,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) xp->xp_shell = TRUE; #endif // When still after the command name expand executables. - if (xp->xp_pattern == skipwhite((const char_u *)arg)) { + if ((char_u *)xp->xp_pattern == skipwhite((const char_u *)arg)) { xp->xp_context = EXPAND_SHELLCMD; } } @@ -3447,7 +3444,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) // A full match ~user<Tab> will be replaced by user's home // directory i.e. something like ~user<Tab> -> /home/user/ if (*p == NUL && p > (const char *)xp->xp_pattern + 1 - && match_user(xp->xp_pattern + 1) >= 1) { + && match_user((char_u *)xp->xp_pattern + 1) >= 1) { xp->xp_context = EXPAND_USER; ++xp->xp_pattern; } @@ -3477,7 +3474,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) break; case CMD_help: xp->xp_context = EXPAND_HELP; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; /* Command modifiers: return the argument. @@ -3554,7 +3551,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) if (p == NULL) { // No "=", so complete attribute names. xp->xp_context = EXPAND_USER_CMD_FLAGS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; return NULL; } @@ -3562,15 +3559,15 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) // their arguments as well. if (STRNICMP(arg, "complete", p - arg) == 0) { xp->xp_context = EXPAND_USER_COMPLETE; - xp->xp_pattern = (char_u *)p + 1; + xp->xp_pattern = (char *)p + 1; return NULL; } else if (STRNICMP(arg, "nargs", p - arg) == 0) { xp->xp_context = EXPAND_USER_NARGS; - xp->xp_pattern = (char_u *)p + 1; + xp->xp_pattern = (char *)p + 1; return NULL; } else if (STRNICMP(arg, "addr", p - arg) == 0) { xp->xp_context = EXPAND_USER_ADDR_TYPE; - xp->xp_pattern = (char_u *)p + 1; + xp->xp_pattern = (char *)p + 1; return NULL; } return NULL; @@ -3582,7 +3579,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) p = (const char *)skiptowhite((const char_u *)arg); if (*p == NUL) { xp->xp_context = EXPAND_USER_COMMANDS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; } @@ -3591,7 +3588,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_delcommand: xp->xp_context = EXPAND_USER_COMMANDS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_global: @@ -3697,11 +3694,11 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) } else { xp->xp_context = EXPAND_TAGS; } - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_augroup: xp->xp_context = EXPAND_AUGROUP; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_syntax: set_context_in_syntax_cmd(xp, arg); @@ -3729,12 +3726,12 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) break; case CMD_unlet: - while ((xp->xp_pattern = (char_u *)strchr(arg, ' ')) != NULL) { + while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) { arg = (const char *)xp->xp_pattern + 1; } xp->xp_context = EXPAND_USER_VARS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; if (*xp->xp_pattern == '$') { xp->xp_context = EXPAND_ENV_VARS; @@ -3746,7 +3743,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_function: case CMD_delfunction: xp->xp_context = EXPAND_USER_FUNC; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_echohl: @@ -3766,7 +3763,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_bdelete: case CMD_bwipeout: case CMD_bunload: - while ((xp->xp_pattern = (char_u *)strchr(arg, ' ')) != NULL) { + while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) { arg = (const char *)xp->xp_pattern + 1; } FALLTHROUGH; @@ -3774,14 +3771,14 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_sbuffer: case CMD_checktime: xp->xp_context = EXPAND_BUFFERS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_diffget: case CMD_diffput: // If current buffer is in diff mode, complete buffer names // which are in diff mode, and different than current buffer. xp->xp_context = EXPAND_DIFF_BUFFERS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_USER: case CMD_USER_BUF: @@ -3808,7 +3805,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) } MB_PTR_ADV(p); } - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; } xp->xp_context = context; } @@ -3854,7 +3851,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_smapclear: case CMD_xmapclear: xp->xp_context = EXPAND_MAPCLEAR; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_abbreviate: @@ -3899,27 +3896,27 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) case CMD_colorscheme: xp->xp_context = EXPAND_COLORS; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_compiler: xp->xp_context = EXPAND_COMPILER; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_ownsyntax: xp->xp_context = EXPAND_OWNSYNTAX; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_setfiletype: xp->xp_context = EXPAND_FILETYPE; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_packadd: xp->xp_context = EXPAND_PACKADD; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; #ifdef HAVE_WORKING_LIBINTL @@ -3927,14 +3924,14 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) p = (const char *)skiptowhite((const char_u *)arg); if (*p == NUL) { xp->xp_context = EXPAND_LANGUAGE; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; } else { if (strncmp(arg, "messages", (size_t)(p - arg)) == 0 || strncmp(arg, "ctype", (size_t)(p - arg)) == 0 || strncmp(arg, "time", (size_t)(p - arg)) == 0 || strncmp(arg, "collate", (size_t)(p - arg)) == 0) { xp->xp_context = EXPAND_LOCALES; - xp->xp_pattern = skipwhite((const char_u *)p); + xp->xp_pattern = (char *)skipwhite((const char_u *)p); } else { xp->xp_context = EXPAND_NOTHING; } @@ -3946,33 +3943,33 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff) break; case CMD_checkhealth: xp->xp_context = EXPAND_CHECKHEALTH; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_behave: xp->xp_context = EXPAND_BEHAVE; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_messages: xp->xp_context = EXPAND_MESSAGES; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_history: xp->xp_context = EXPAND_HISTORY; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_syntime: xp->xp_context = EXPAND_SYNTIME; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_argdelete: - while ((xp->xp_pattern = vim_strchr((const char_u *)arg, ' ')) != NULL) { + while ((xp->xp_pattern = (char *)vim_strchr((const char_u *)arg, ' ')) != NULL) { arg = (const char *)(xp->xp_pattern + 1); } xp->xp_context = EXPAND_ARGLIST; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; break; case CMD_lua: @@ -4377,7 +4374,7 @@ static void get_flags(exarg_T *eap) } else { eap->flags |= EXFLAG_NR; } - eap->arg = skipwhite(eap->arg + 1); + eap->arg = (char *)skipwhite((char_u *)eap->arg + 1); } } @@ -4507,7 +4504,7 @@ static void correct_range(exarg_T *eap) /// pattern. Otherwise return eap->arg. static char *skip_grep_pat(exarg_T *eap) { - char *p = (char *)eap->arg; + char *p = eap->arg; if (*p != NUL && (eap->cmdidx == CMD_vimgrep || eap->cmdidx == CMD_lvimgrep || eap->cmdidx == CMD_vimgrepadd @@ -4515,7 +4512,7 @@ static char *skip_grep_pat(exarg_T *eap) || grep_internal(eap->cmdidx))) { p = skip_vimgrep_pat(p, NULL, NULL); if (p == NULL) { - p = (char *)eap->arg; + p = eap->arg; } } return p; @@ -4633,7 +4630,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp) /* * Try to find a match at this position. */ - repl = (char *)eval_vars((char_u *)p, eap->arg, &srclen, &(eap->do_ecmd_lnum), + repl = (char *)eval_vars((char_u *)p, (char_u *)eap->arg, &srclen, &(eap->do_ecmd_lnum), errormsgp, &escaped); if (*errormsgp != NULL) { // error detected return FAIL; @@ -4718,16 +4715,16 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp) * After expanding environment variables, check again * if there are still wildcards present. */ - if (vim_strchr(eap->arg, '$') != NULL - || vim_strchr(eap->arg, '~') != NULL) { - expand_env_esc(eap->arg, NameBuff, MAXPATHL, true, true, NULL); + if (vim_strchr((char_u *)eap->arg, '$') != NULL + || vim_strchr((char_u *)eap->arg, '~') != NULL) { + expand_env_esc((char_u *)eap->arg, NameBuff, MAXPATHL, true, true, NULL); has_wildcards = path_has_wildcard(NameBuff); p = (char *)NameBuff; } else { p = NULL; } if (p != NULL) { - (void)repl_cmdline(eap, (char *)eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep); + (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep); } } @@ -4739,7 +4736,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp) #ifdef UNIX if (!has_wildcards) #endif - backslash_halve(eap->arg); + backslash_halve((char_u *)eap->arg); if (has_wildcards) { expand_T xpc; @@ -4750,11 +4747,11 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp) if (p_wic) { options += WILD_ICASE; } - p = (char *)ExpandOne(&xpc, eap->arg, NULL, options, WILD_EXPAND_FREE); + p = (char *)ExpandOne(&xpc, (char_u *)eap->arg, NULL, options, WILD_EXPAND_FREE); if (p == NULL) { return FAIL; } - (void)repl_cmdline(eap, (char *)eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep); + (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep); xfree(p); } } @@ -4798,12 +4795,12 @@ static char *repl_cmdline(exarg_T *eap, char *src, size_t srclen, char *repl, ch if (eap->nextcmd != NULL) { // append next command i = STRLEN(new_cmdline) + 1; STRCPY(new_cmdline + i, eap->nextcmd); - eap->nextcmd = (char_u *)new_cmdline + i; + eap->nextcmd = new_cmdline + i; } eap->cmd = new_cmdline + (eap->cmd - *cmdlinep); - eap->arg = (char_u *)new_cmdline + ((char *)eap->arg - *cmdlinep); - if (eap->do_ecmd_cmd != NULL && eap->do_ecmd_cmd != (char_u *)dollar_command) { - eap->do_ecmd_cmd = (char_u *)new_cmdline + ((char *)eap->do_ecmd_cmd - *cmdlinep); + eap->arg = new_cmdline + (eap->arg - *cmdlinep); + if (eap->do_ecmd_cmd != NULL && eap->do_ecmd_cmd != dollar_command) { + eap->do_ecmd_cmd = new_cmdline + (eap->do_ecmd_cmd - *cmdlinep); } xfree(*cmdlinep); *cmdlinep = new_cmdline; @@ -4840,9 +4837,9 @@ void separate_nextcmd(exarg_T *eap) // :redir @" doesn't either. (*p == '"' && !(eap->argt & EX_NOTRLCOM) - && (eap->cmdidx != CMD_at || (char_u *)p != eap->arg) + && (eap->cmdidx != CMD_at || p != eap->arg) && (eap->cmdidx != CMD_redir - || (char_u *)p != eap->arg + 1 || p[-1] != '@')) || *p == '|' || *p == '\n') { + || p != eap->arg + 1 || p[-1] != '@')) || *p == '|' || *p == '\n') { // We remove the '\' before the '|', unless EX_CTRLV is used // AND 'b' is present in 'cpoptions'. if ((vim_strchr(p_cpo, CPO_BAR) == NULL @@ -4850,7 +4847,7 @@ void separate_nextcmd(exarg_T *eap) STRMOVE(p - 1, p); // remove the '\' p--; } else { - eap->nextcmd = check_nextcmd((char_u *)p); + eap->nextcmd = (char *)check_nextcmd((char_u *)p); *p = NUL; break; } @@ -4858,7 +4855,7 @@ void separate_nextcmd(exarg_T *eap) } if (!(eap->argt & EX_NOTRLCOM)) { // remove trailing spaces - del_trailing_spaces(eap->arg); + del_trailing_spaces((char_u *)eap->arg); } } @@ -4924,7 +4921,7 @@ int get_bad_opt(const char_u *p, exarg_T *eap) /// @return FAIL or OK. static int getargopt(exarg_T *eap) { - char *arg = (char *)eap->arg + 2; + char *arg = eap->arg + 2; int *pp = NULL; int bad_char_idx; char *p; @@ -4940,14 +4937,14 @@ static int getargopt(exarg_T *eap) if (!checkforcmd(&arg, "binary", 3)) { return FAIL; } - eap->arg = skipwhite((char_u *)arg); + eap->arg = (char *)skipwhite((char_u *)arg); return OK; } // ":read ++edit file" if (STRNCMP(arg, "edit", 4) == 0) { eap->read_edit = true; - eap->arg = skipwhite((char_u *)arg + 4); + eap->arg = (char *)skipwhite((char_u *)arg + 4); return OK; } @@ -4976,7 +4973,7 @@ static int getargopt(exarg_T *eap) arg++; *pp = (int)(arg - eap->cmd); arg = skip_cmd_arg(arg, false); - eap->arg = skipwhite((char_u *)arg); + eap->arg = (char *)skipwhite((char_u *)arg); *arg = NUL; if (pp == &eap->force_ff) { @@ -5010,7 +5007,7 @@ static int get_tabpage_arg(exarg_T *eap) int unaccept_arg0 = (eap->cmdidx == CMD_tabmove) ? 0 : 1; if (eap->arg && *eap->arg != NUL) { - char *p = (char *)eap->arg; + char *p = eap->arg; char *p_save; int relative = 0; // argument +N/-N means: go to N places to the // right/left relative to the current position. @@ -5033,7 +5030,7 @@ static int get_tabpage_arg(exarg_T *eap) if (valid_tabpage(lastused_tabpage)) { tab_number = tabpage_index(lastused_tabpage); } else { - eap->errmsg = ex_errmsg(e_invargval, (char *)eap->arg); + eap->errmsg = ex_errmsg(e_invargval, eap->arg); tab_number = 0; goto theend; } @@ -5065,7 +5062,7 @@ static int get_tabpage_arg(exarg_T *eap) tab_number = 0; } else { tab_number = (int)eap->line2; - if (!unaccept_arg0 && *skipwhite(*eap->cmdlinep) == '-') { + if (!unaccept_arg0 && *skipwhite((char_u *)(*eap->cmdlinep)) == '-') { tab_number--; if (tab_number < unaccept_arg0) { eap->errmsg = e_invarg; @@ -5122,13 +5119,13 @@ static void ex_unmap(exarg_T *eap) /// ":mapclear" and friends. static void ex_mapclear(exarg_T *eap) { - map_clear_mode((char_u *)eap->cmd, eap->arg, eap->forceit, false); + map_clear_mode((char_u *)eap->cmd, (char_u *)eap->arg, eap->forceit, false); } /// ":abclear" and friends. static void ex_abclear(exarg_T *eap) { - map_clear_mode((char_u *)eap->cmd, eap->arg, true, true); + map_clear_mode((char_u *)eap->cmd, (char_u *)eap->arg, true, true); } static void ex_autocmd(exarg_T *eap) @@ -5139,16 +5136,16 @@ static void ex_autocmd(exarg_T *eap) secure = 2; eap->errmsg = e_curdir; } else if (eap->cmdidx == CMD_autocmd) { - do_autocmd(eap->arg, eap->forceit); + do_autocmd((char_u *)eap->arg, eap->forceit); } else { - do_augroup(eap->arg, eap->forceit); + do_augroup((char_u *)eap->arg, eap->forceit); } } /// ":doautocmd": Apply the automatic commands to the current buffer. static void ex_doautocmd(exarg_T *eap) { - char *arg = (char *)eap->arg; + char *arg = eap->arg; int call_do_modelines = check_nomodeline((char_u **)&arg); bool did_aucmd; @@ -5164,11 +5161,13 @@ static void ex_doautocmd(exarg_T *eap) /// :[N]bwipeout[!] [N] [bufname] delete buffer really static void ex_bunload(exarg_T *eap) { - eap->errmsg = do_bufdel(eap->cmdidx == CMD_bdelete ? DOBUF_DEL - : eap->cmdidx == CMD_bwipeout ? DOBUF_WIPE - : DOBUF_UNLOAD, - eap->arg, - eap->addr_count, (int)eap->line1, (int)eap->line2, eap->forceit); + eap->errmsg = do_bufdel(eap->cmdidx == CMD_bdelete + ? DOBUF_DEL + : eap->cmdidx == CMD_bwipeout + ? DOBUF_WIPE + : DOBUF_UNLOAD, + (char_u *)eap->arg, eap->addr_count, (int)eap->line1, (int)eap->line2, + eap->forceit); } /// :[N]buffer [N] to buffer N @@ -5184,7 +5183,7 @@ static void ex_buffer(exarg_T *eap) goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); } if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } } @@ -5195,7 +5194,7 @@ static void ex_bmodified(exarg_T *eap) { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5205,7 +5204,7 @@ static void ex_bnext(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5217,7 +5216,7 @@ static void ex_bprevious(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5229,7 +5228,7 @@ static void ex_brewind(exarg_T *eap) { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5239,7 +5238,7 @@ static void ex_blast(exarg_T *eap) { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5835,7 +5834,7 @@ static void ex_command(exarg_T *eap) int has_attr = (eap->arg[0] == '-'); size_t name_len; - p = (char *)eap->arg; + p = eap->arg; // Check for attributes while (*p == '-') { @@ -5904,7 +5903,7 @@ static void ex_delcommand(exarg_T *eap) ucmd_T *cmd = NULL; int res = -1; garray_T *gap; - const char *arg = (char *)eap->arg; + const char *arg = eap->arg; bool buffer_only = false; if (STRNCMP(arg, "-buffer", 7) == 0 && ascii_iswhite(arg[7])) { @@ -6166,7 +6165,7 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar break; case 1: // Quote, but don't split result = STRLEN(eap->arg) + 2; - for (p = (char *)eap->arg; *p; p++) { + for (p = eap->arg; *p; p++) { if (*p == '\\' || *p == '"') { result++; } @@ -6174,7 +6173,7 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar if (buf != NULL) { *buf++ = '"'; - for (p = (char *)eap->arg; *p; p++) { + for (p = eap->arg; *p; p++) { if (*p == '\\' || *p == '"') { *buf++ = '\\'; } @@ -6187,7 +6186,7 @@ static size_t uc_check_code(char *code, size_t len, char *buf, ucmd_T *cmd, exar case 2: // Quote and split (<f-args>) // This is hard, so only do it once, and cache the result if (*split_buf == NULL) { - *split_buf = uc_split_args((char *)eap->arg, split_len); + *split_buf = uc_split_args(eap->arg, split_len); } result = *split_len; @@ -6703,7 +6702,7 @@ static void ex_colorscheme(exarg_T *eap) } else { msg("default"); } - } else if (load_colors(eap->arg) == FAIL) { + } else if (load_colors((char_u *)eap->arg) == FAIL) { semsg(_("E185: Cannot find color scheme '%s'"), eap->arg); } } @@ -7361,7 +7360,7 @@ static void ex_recover(exarg_T *eap) | CCGD_EXCMD) && (*eap->arg == NUL - || setfname(curbuf, eap->arg, NULL, true) == OK)) { + || setfname(curbuf, (char_u *)eap->arg, NULL, true) == OK)) { ml_recover(true); } recoverymode = false; @@ -7404,12 +7403,12 @@ void ex_splitview(exarg_T *eap) } if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind) { - fname = (char *)find_file_in_path(eap->arg, STRLEN(eap->arg), + fname = (char *)find_file_in_path((char_u *)eap->arg, STRLEN(eap->arg), FNAME_MESS, true, curbuf->b_ffname); if (fname == NULL) { goto theend; } - eap->arg = (char_u *)fname; + eap->arg = fname; } /* @@ -7417,7 +7416,7 @@ void ex_splitview(exarg_T *eap) */ if (use_tab) { if (win_new_tabpage(cmdmod.tab != 0 ? cmdmod.tab : eap->addr_count == 0 - ? 0 : (int)eap->line2 + 1, eap->arg) != FAIL) { + ? 0 : (int)eap->line2 + 1, (char_u *)eap->arg) != FAIL) { do_exedit(eap, old_curwin); apply_autocmds(EVENT_TABNEWENTERED, NULL, NULL, false, curbuf); @@ -7454,7 +7453,7 @@ void tabpage_new(void) memset(&ea, 0, sizeof(ea)); ea.cmdidx = CMD_tabnew; ea.cmd = "tabn"; - ea.arg = (char_u *)""; + ea.arg = ""; ex_splitview(&ea); } @@ -7474,7 +7473,7 @@ static void ex_tabnext(exarg_T *eap) case CMD_tabprevious: case CMD_tabNext: if (eap->arg && *eap->arg != NUL) { - char *p = (char *)eap->arg; + char *p = eap->arg; char *p_save = p; tab_number = (int)getdigits((char_u **)&p, false, 0); if (p == p_save || *p_save == '-' || *p_save == '+' || *p != NUL @@ -7584,7 +7583,7 @@ static void ex_resize(exarg_T *eap) for (wp = firstwin; wp->w_next != NULL && --n > 0; wp = wp->w_next) {} } - n = (int)atol((char *)eap->arg); + n = (int)atol(eap->arg); if (cmdmod.split & WSP_VERT) { if (*eap->arg == '-' || *eap->arg == '+') { n += wp->w_width; @@ -7608,7 +7607,7 @@ static void ex_find(exarg_T *eap) char *fname; linenr_T count; - fname = (char *)find_file_in_path(eap->arg, STRLEN(eap->arg), + fname = (char *)find_file_in_path((char_u *)eap->arg, STRLEN(eap->arg), FNAME_MESS, true, curbuf->b_ffname); if (eap->addr_count > 0) { // Repeat finding the file "count" times. This matters when it @@ -7621,7 +7620,7 @@ static void ex_find(exarg_T *eap) } if (fname != NULL) { - eap->arg = (char_u *)fname; + eap->arg = fname; do_exedit(eap, NULL); xfree(fname); } @@ -7702,7 +7701,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin) if (eap->cmdidx != CMD_balt && eap->cmdidx != CMD_badd) { setpcmark(); } - if (do_ecmd(0, eap->cmdidx == CMD_enew ? NULL : (char *)eap->arg, + if (do_ecmd(0, eap->cmdidx == CMD_enew ? NULL : eap->arg, NULL, eap, eap->do_ecmd_lnum, (buf_hide(curbuf) ? ECMD_HIDE : 0) + (eap->forceit ? ECMD_FORCEIT : 0) @@ -7738,7 +7737,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin) readonlymode = n; } else { if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd((char *)eap->do_ecmd_cmd); + do_cmdline_cmd(eap->do_ecmd_cmd); } n = curwin->w_arg_idx_invalid; check_arg_idx(curwin); @@ -7869,9 +7868,9 @@ static void ex_read(exarg_T *eap) eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } else { if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) { - (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); + (void)setaltfname((char_u *)eap->arg, (char_u *)eap->arg, (linenr_T)1); } - i = readfile(eap->arg, NULL, + i = readfile((char_u *)eap->arg, NULL, eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } if (i != OK) { @@ -8046,7 +8045,7 @@ bool changedir_func(char *new_dir, CdScope scope) /// ":cd", ":tcd", ":lcd", ":chdir", "tchdir" and ":lchdir". void ex_cd(exarg_T *eap) { - char *new_dir = (char *)eap->arg; + char *new_dir = eap->arg; #if !defined(UNIX) // for non-UNIX ":cd" means: print current directory unless 'cdhome' is set if (*new_dir == NUL && !p_cdh) { @@ -8156,7 +8155,7 @@ static void do_exmap(exarg_T *eap, int isabbrev) mode = get_map_mode((char_u **)&cmdp, eap->forceit || isabbrev); switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'), - eap->arg, mode, isabbrev)) { + (char_u *)eap->arg, mode, isabbrev)) { case 1: emsg(_(e_invarg)); break; @@ -8169,7 +8168,7 @@ static void do_exmap(exarg_T *eap, int isabbrev) /// ":winsize" command (obsolete). static void ex_winsize(exarg_T *eap) { - char *arg = (char *)eap->arg; + char *arg = eap->arg; if (!ascii_isdigit(*arg)) { semsg(_(e_invarg2), arg); @@ -8197,13 +8196,13 @@ static void ex_wincmd(exarg_T *eap) emsg(_(e_invarg)); return; } - xchar = eap->arg[1]; - p = (char *)eap->arg + 2; + xchar = (uint8_t)eap->arg[1]; + p = eap->arg + 2; } else { - p = (char *)eap->arg + 1; + p = eap->arg + 1; } - eap->nextcmd = check_nextcmd((char_u *)p); + eap->nextcmd = (char *)check_nextcmd((char_u *)p); p = (char *)skipwhite((char_u *)p); if (*p != NUL && *p != '"' && eap->nextcmd == NULL) { emsg(_(e_invarg)); @@ -8281,7 +8280,7 @@ static void ex_put(exarg_T *eap) /// Handle ":copy" and ":move". static void ex_copymove(exarg_T *eap) { - long n = get_address(eap, (char **)&eap->arg, eap->addr_type, false, false, false, 1); + long n = get_address(eap, &eap->arg, eap->addr_type, false, false, false, 1); if (eap->arg == NULL) { // error detected eap->nextcmd = NULL; return; @@ -8356,7 +8355,7 @@ static void ex_at(exarg_T *eap) check_cursor_col(); // Get the register name. No name means use the previous one. - int c = *eap->arg; + int c = (uint8_t)(*eap->arg); if (c == NUL) { c = '@'; } @@ -8432,7 +8431,7 @@ static void ex_wundo(exarg_T *eap) char hash[UNDO_HASH_SIZE]; u_compute_hash(curbuf, (char_u *)hash); - u_write_undo((char *)eap->arg, eap->forceit, curbuf, (char_u *)hash); + u_write_undo(eap->arg, eap->forceit, curbuf, (char_u *)hash); } static void ex_rundo(exarg_T *eap) @@ -8440,7 +8439,7 @@ static void ex_rundo(exarg_T *eap) char hash[UNDO_HASH_SIZE]; u_compute_hash(curbuf, (char_u *)hash); - u_read_undo((char *)eap->arg, (char_u *)hash, NULL); + u_read_undo(eap->arg, (char_u *)hash, NULL); } /// ":redo". @@ -8455,7 +8454,7 @@ static void ex_later(exarg_T *eap) long count = 0; bool sec = false; bool file = false; - char *p = (char *)eap->arg; + char *p = eap->arg; if (*p == NUL) { count = 1; @@ -8488,7 +8487,7 @@ static void ex_redir(exarg_T *eap) { char *mode; char *fname; - char *arg = (char *)eap->arg; + char *arg = eap->arg; if (STRICMP(eap->arg, "END") == 0) { close_redir(); @@ -8813,7 +8812,7 @@ static void ex_normal(exarg_T *eap) int len = 0; // Count the number of characters to be escaped. - for (p = (char *)eap->arg; *p != NUL; p++) { + for (p = eap->arg; *p != NUL; p++) { for (l = utfc_ptr2len((char_u *)p) - 1; l > 0; l--) { if (*++p == (char)K_SPECIAL) { // trailbyte K_SPECIAL len += 2; @@ -8823,7 +8822,7 @@ static void ex_normal(exarg_T *eap) if (len > 0) { arg = xmalloc(STRLEN(eap->arg) + (size_t)len + 1); len = 0; - for (p = (char *)eap->arg; *p != NUL; p++) { + for (p = eap->arg; *p != NUL; p++) { arg[len++] = *p; for (l = utfc_ptr2len((char_u *)p) - 1; l > 0; l--) { arg[len++] = *++p; @@ -8849,7 +8848,7 @@ static void ex_normal(exarg_T *eap) check_cursor_moved(curwin); } - exec_normal_cmd(arg != NULL ? (char_u *)arg : eap->arg, + exec_normal_cmd((char_u *)(arg != NULL ? arg : eap->arg), eap->forceit ? REMAP_NONE : REMAP_YES, false); } while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int); } @@ -8981,13 +8980,13 @@ static void ex_findpat(exarg_T *eap) n = 1; if (ascii_isdigit(*eap->arg)) { // get count - n = getdigits_long(&eap->arg, false, 0); - eap->arg = skipwhite(eap->arg); + n = getdigits_long((char_u **)&eap->arg, false, 0); + eap->arg = (char *)skipwhite((char_u *)eap->arg); } if (*eap->arg == '/') { // Match regexp, not just whole words whole = false; eap->arg++; - p = (char *)skip_regexp(eap->arg, '/', p_magic, NULL); + p = (char *)skip_regexp((char_u *)eap->arg, '/', p_magic, NULL); if (*p) { *p++ = NUL; p = (char *)skipwhite((char_u *)p); @@ -8996,12 +8995,12 @@ static void ex_findpat(exarg_T *eap) if (!ends_excmd(*p)) { eap->errmsg = e_trailing; } else { - eap->nextcmd = check_nextcmd((char_u *)p); + eap->nextcmd = (char *)check_nextcmd((char_u *)p); } } } if (!eap->skip) { - find_pattern_in_path(eap->arg, 0, STRLEN(eap->arg), whole, !eap->forceit, + find_pattern_in_path((char_u *)eap->arg, 0, STRLEN(eap->arg), whole, !eap->forceit, *eap->cmd == 'd' ? FIND_DEFINE : FIND_ANY, n, action, eap->line1, eap->line2); } @@ -9094,8 +9093,8 @@ static void ex_tag_cmd(exarg_T *eap, char *name) cmd = DT_LTAG; } - do_tag(eap->arg, cmd, eap->addr_count > 0 ? (int)eap->line2 : 1, - eap->forceit, TRUE); + do_tag((char_u *)eap->arg, cmd, eap->addr_count > 0 ? (int)eap->line2 : 1, + eap->forceit, true); } enum { @@ -9550,9 +9549,9 @@ static void ex_shada(exarg_T *eap) p_shada = (char_u *)"'100"; } if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) { - (void)shada_read_everything((char *)eap->arg, eap->forceit, false); + (void)shada_read_everything(eap->arg, eap->forceit, false); } else { - shada_write_file((char *)eap->arg, eap->forceit); + shada_write_file(eap->arg, eap->forceit); } p_shada = (char_u *)save_shada; } @@ -9629,7 +9628,7 @@ static TriState filetype_indent = kNone; /// indent off: load indoff.vim static void ex_filetype(exarg_T *eap) { - char *arg = (char *)eap->arg; + char *arg = eap->arg; bool plugin = false; bool indent = false; @@ -9724,14 +9723,14 @@ void filetype_maybe_enable(void) static void ex_setfiletype(exarg_T *eap) { if (!did_filetype) { - char *arg = (char *)eap->arg; + char *arg = eap->arg; if (STRNCMP(arg, "FALLBACK ", 9) == 0) { arg += 9; } set_option_value("filetype", 0L, arg, OPT_LOCAL); - if ((char_u *)arg != eap->arg) { + if (arg != eap->arg) { did_filetype = false; } } @@ -9740,7 +9739,7 @@ static void ex_setfiletype(exarg_T *eap) static void ex_digraphs(exarg_T *eap) { if (*eap->arg != NUL) { - putdigraph(eap->arg); + putdigraph((char_u *)eap->arg); } else { listdigraphs(eap->forceit); } @@ -9784,7 +9783,7 @@ static void ex_folddo(exarg_T *eap) } } - global_exe((char *)eap->arg); // Execute the command on the marked lines. + global_exe(eap->arg); // Execute the command on the marked lines. ml_clearmarked(); // clear rest of the marks } @@ -9815,7 +9814,7 @@ static void ex_terminal(exarg_T *eap) char ex_cmd[1024]; if (*eap->arg != NUL) { // Run {cmd} in 'shell'. - char *name = (char *)vim_strsave_escaped(eap->arg, (char_u *)"\"\\"); + char *name = (char *)vim_strsave_escaped((char_u *)eap->arg, (char_u *)"\"\\"); snprintf(ex_cmd, sizeof(ex_cmd), ":enew%s | call termopen(\"%s\")", eap->forceit ? "!" : "", name); diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 570ae0d85e..c00f27a3c1 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -148,7 +148,7 @@ int aborted_in_try(void) /// When several messages appear in the same command, the first is usually the /// most specific one and used as the exception value. The "severe" flag can be /// set to true, if a later but severer message should be used instead. -bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore) +bool cause_errthrow(const char *mesg, bool severe, bool *ignore) FUNC_ATTR_NONNULL_ALL { struct msglist *elem; @@ -197,7 +197,7 @@ bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore) * interrupt exception is catchable by the innermost try conditional and * not replaced by an interrupt message error exception. */ - if (mesg == (char_u *)_(e_interr)) { + if (mesg == _(e_interr)) { *ignore = true; return true; } @@ -255,7 +255,7 @@ bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore) } elem = xmalloc(sizeof(struct msglist)); - elem->msg = (char *)vim_strsave(mesg); + elem->msg = xstrdup(mesg); elem->next = NULL; elem->throw_msg = NULL; *plist = elem; @@ -305,7 +305,7 @@ void free_global_msglist(void) /// Throw the message specified in the call to cause_errthrow() above as an /// error exception. If cstack is NULL, postpone the throw until do_cmdline() /// has returned (see do_one_cmd()). -void do_errthrow(cstack_T *cstack, char_u *cmdname) +void do_errthrow(cstack_T *cstack, char *cmdname) { /* * Ensure that all commands in nested function calls and sourced files @@ -382,7 +382,7 @@ int do_intthrow(cstack_T *cstack) } /// Get an exception message that is to be stored in current_exception->value. -char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free) +char *get_exception_string(void *value, except_type_T type, char *cmdname, int *should_free) { char *ret, *mesg; char *p, *val; @@ -446,7 +446,7 @@ char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int /// /// @return FAIL when out of memory or it was tried to throw an illegal user /// exception. -static int throw_exception(void *value, except_type_T type, char_u *cmdname) +static int throw_exception(void *value, except_type_T type, char *cmdname) { except_T *excp; int should_free; @@ -479,8 +479,7 @@ static int throw_exception(void *value, except_type_T type, char_u *cmdname) } excp->type = type; - excp->throw_name = vim_strsave(sourcing_name == NULL - ? (char_u *)"" : sourcing_name); + excp->throw_name = (char *)vim_strsave(sourcing_name == NULL ? (char_u *)"" : sourcing_name); excp->throw_lnum = sourcing_lnum; if (p_verbose >= 13 || debug_break_level > 0) { @@ -525,7 +524,7 @@ fail: /// caught and the catch clause has been ended normally. static void discard_exception(except_T *excp, bool was_finished) { - char_u *saved_IObuff; + char *saved_IObuff; if (current_exception == excp) { current_exception = NULL; @@ -538,7 +537,7 @@ static void discard_exception(except_T *excp, bool was_finished) if (p_verbose >= 13 || debug_break_level > 0) { int save_msg_silent = msg_silent; - saved_IObuff = vim_strsave(IObuff); + saved_IObuff = (char *)vim_strsave(IObuff); if (debug_break_level > 0) { msg_silent = FALSE; // display messages } else { @@ -801,7 +800,7 @@ void ex_eval(exarg_T *eap) { typval_T tv; - if (eval0((char *)eap->arg, &tv, (char **)&eap->nextcmd, !eap->skip) == OK) { + if (eval0(eap->arg, &tv, &eap->nextcmd, !eap->skip) == OK) { tv_clear(&tv); } } @@ -822,7 +821,7 @@ void ex_if(exarg_T *eap) skip = CHECK_SKIP; bool error; - result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); if (!skip && !error) { if (result) { @@ -911,7 +910,7 @@ void ex_else(exarg_T *eap) if (eap->cmdidx == CMD_elseif) { bool error; - result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); // When throwing error exceptions, we want to throw always the first // of several errors in a row. This is what actually happens when // a conditional error was detected above and there is another failure @@ -962,7 +961,7 @@ void ex_while(exarg_T *eap) /* * ":while bool-expr" */ - result = eval_to_bool((char *)eap->arg, &error, (char **)&eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); } else { void *fi; @@ -976,13 +975,13 @@ void ex_while(exarg_T *eap) error = FALSE; } else { // Evaluate the argument and get the info in a structure. - fi = eval_for_line((char *)eap->arg, &error, (char **)&eap->nextcmd, skip); + fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip); cstack->cs_forinfo[cstack->cs_idx] = fi; } // use the element at the start of the list and advance if (!error && fi != NULL && !skip) { - result = next_for_item(fi, (char *)eap->arg); + result = next_for_item(fi, eap->arg); } else { result = FALSE; } @@ -1283,13 +1282,13 @@ void ex_catch(exarg_T *eap) bool give_up = false; bool skip = false; bool caught = false; - char_u *end; - char_u save_char = 0; - char_u *save_cpo; + char *end; + char save_char = 0; + char *save_cpo; regmatch_T regmatch; int prev_got_int; cstack_T *const cstack = eap->cstack; - char_u *pat; + char *pat; if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) { eap->errmsg = N_("E603: :catch without :try"); @@ -1318,12 +1317,12 @@ void ex_catch(exarg_T *eap) } if (ends_excmd(*eap->arg)) { // no argument, catch all errors - pat = (char_u *)".*"; + pat = ".*"; end = NULL; - eap->nextcmd = find_nextcmd(eap->arg); + eap->nextcmd = (char *)find_nextcmd((char_u *)eap->arg); } else { pat = eap->arg + 1; - end = skip_regexp(pat, *eap->arg, TRUE, NULL); + end = (char *)skip_regexp((char_u *)pat, *eap->arg, true, NULL); } if (!give_up) { @@ -1343,7 +1342,7 @@ void ex_catch(exarg_T *eap) */ if (!skip && (cstack->cs_flags[idx] & CSF_THROWN) && !(cstack->cs_flags[idx] & CSF_CAUGHT)) { - if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) { + if (end != NULL && *end != NUL && !ends_excmd(*skipwhite((char_u *)end + 1))) { emsg(_(e_trailing)); return; } @@ -1362,18 +1361,18 @@ void ex_catch(exarg_T *eap) save_char = *end; *end = NUL; } - save_cpo = p_cpo; + save_cpo = (char *)p_cpo; p_cpo = (char_u *)""; // Disable error messages, it will make current exception // invalid emsg_off++; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = vim_regcomp((char_u *)pat, RE_MAGIC + RE_STRING); emsg_off--; regmatch.rm_ic = false; if (end != NULL) { *end = save_char; } - p_cpo = save_cpo; + p_cpo = (char_u *)save_cpo; if (regmatch.regprog == NULL) { semsg(_(e_invarg2), pat); } else { @@ -1426,7 +1425,7 @@ void ex_catch(exarg_T *eap) } if (end != NULL) { - eap->nextcmd = find_nextcmd(end); + eap->nextcmd = (char *)find_nextcmd((char_u *)end); } } @@ -2036,7 +2035,7 @@ void ex_endfunction(exarg_T *eap) } /// @return TRUE if the string "p" looks like a ":while" or ":for" command. -int has_loop_cmd(char_u *p) +int has_loop_cmd(char *p) { int len; @@ -2045,7 +2044,7 @@ int has_loop_cmd(char_u *p) while (*p == ' ' || *p == '\t' || *p == ':') { ++p; } - len = modifier_len((char *)p); + len = modifier_len(p); if (len == 0) { break; } diff --git a/src/nvim/ex_eval.h b/src/nvim/ex_eval.h index 98573c7182..235875fb91 100644 --- a/src/nvim/ex_eval.h +++ b/src/nvim/ex_eval.h @@ -62,7 +62,7 @@ struct vim_exception { except_type_T type; // exception type char *value; // exception value struct msglist *messages; // message(s) causing error exception - char_u *throw_name; // name of the throw point + char *throw_name; // name of the throw point linenr_T throw_lnum; // line number of the throw point except_T *caught; // next exception on the caught stack }; diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 8a37c5bc93..25cbb33e55 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -833,8 +833,8 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init if (ccline.input_fn) { s->xpc.xp_context = ccline.xp_context; - s->xpc.xp_pattern = ccline.cmdbuff; - s->xpc.xp_arg = ccline.xp_arg; + s->xpc.xp_pattern = (char *)ccline.cmdbuff; + s->xpc.xp_arg = (char *)ccline.xp_arg; } // Avoid scrolling when called by a recursive do_cmdline(), e.g. when @@ -1210,7 +1210,7 @@ static int command_line_execute(VimState *state, int key) // cursor int found = false; - int j = (int)(s->xpc.xp_pattern - ccline.cmdbuff); + int j = (int)((char_u *)s->xpc.xp_pattern - ccline.cmdbuff); int i = 0; while (--j > 0) { // check for start of menu name @@ -1265,7 +1265,7 @@ static int command_line_execute(VimState *state, int key) int found = false; int j = ccline.cmdpos; - int i = (int)(s->xpc.xp_pattern - ccline.cmdbuff); + int i = (int)((char_u *)s->xpc.xp_pattern - ccline.cmdbuff); while (--j > i) { j -= utf_head_off(ccline.cmdbuff, ccline.cmdbuff + j); if (vim_ispathsep(ccline.cmdbuff[j])) { @@ -1286,7 +1286,7 @@ static int command_line_execute(VimState *state, int key) int found = false; int j = ccline.cmdpos - 1; - int i = (int)(s->xpc.xp_pattern - ccline.cmdbuff); + int i = (int)((char_u *)s->xpc.xp_pattern - ccline.cmdbuff); while (--j > i) { j -= utf_head_off(ccline.cmdbuff, ccline.cmdbuff + j); if (vim_ispathsep(ccline.cmdbuff[j]) @@ -2665,12 +2665,12 @@ static void realloc_cmdbuff(int len) && ccline.xpc->xp_pattern != NULL && ccline.xpc->xp_context != EXPAND_NOTHING && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) { - int i = (int)(ccline.xpc->xp_pattern - p); + int i = (int)((char_u *)ccline.xpc->xp_pattern - p); // If xp_pattern points inside the old cmdbuff it needs to be adjusted // to point into the newly allocated memory. if (i >= 0 && i <= ccline.cmdlen) { - ccline.xpc->xp_pattern = ccline.cmdbuff + i; + ccline.xpc->xp_pattern = (char *)ccline.cmdbuff + i; } } } @@ -3764,7 +3764,7 @@ static int nextwild(expand_T *xp, int type, int options, int escape) ui_flush(); } - i = (int)(xp->xp_pattern - ccline.cmdbuff); + i = (int)((char_u *)xp->xp_pattern - ccline.cmdbuff); assert(ccline.cmdpos >= i); xp->xp_pattern_len = (size_t)ccline.cmdpos - (size_t)i; @@ -3773,7 +3773,7 @@ static int nextwild(expand_T *xp, int type, int options, int escape) p2 = ExpandOne(xp, NULL, NULL, 0, type); } else { // Translate string into pattern and expand it. - p1 = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); + p1 = addstar((char_u *)xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); const int use_options = ( options | WILD_HOME_REPLACE @@ -3787,7 +3787,7 @@ static int nextwild(expand_T *xp, int type, int options, int escape) // xp->xp_pattern might have been modified by ExpandOne (for example, // in lua completion), so recompute the pattern index and length - i = (int)(xp->xp_pattern - ccline.cmdbuff); + i = (int)((char_u *)xp->xp_pattern - ccline.cmdbuff); xp->xp_pattern_len = (size_t)ccline.cmdpos - (size_t)i; // Longest match: make sure it is not shorter, happens with :help. @@ -3808,7 +3808,7 @@ static int nextwild(expand_T *xp, int type, int options, int escape) difflen = (int)STRLEN(p2) - (int)(xp->xp_pattern_len); if (ccline.cmdlen + difflen + 4 > ccline.cmdbufflen) { realloc_cmdbuff(ccline.cmdlen + difflen + 4); - xp->xp_pattern = ccline.cmdbuff + i; + xp->xp_pattern = (char *)ccline.cmdbuff + i; } assert(ccline.cmdpos <= ccline.cmdlen); memmove(&ccline.cmdbuff[ccline.cmdpos + difflen], @@ -3918,13 +3918,13 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode compl_selected = findex; cmdline_pum_display(false); } else if (p_wmnu) { - win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files, + win_redr_status_matches(xp, xp->xp_numfiles, (char_u **)xp->xp_files, findex, cmd_showtail); } if (findex == -1) { return vim_strsave(orig_save); } - return vim_strsave(xp->xp_files[findex]); + return vim_strsave((char_u *)xp->xp_files[findex]); } else { return NULL; } @@ -3934,12 +3934,12 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode ss = vim_strsave(orig_save ? orig_save : (char_u *)""); } else if (mode == WILD_APPLY) { ss = vim_strsave(findex == -1 ? (orig_save ? orig_save : (char_u *)"") : - xp->xp_files[findex]); + (char_u *)xp->xp_files[findex]); } // free old names if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) { - FreeWild(xp->xp_numfiles, xp->xp_files); + FreeWild(xp->xp_numfiles, (char_u **)xp->xp_files); xp->xp_numfiles = -1; XFREE_CLEAR(orig_save); } @@ -3957,7 +3957,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode /* * Do the expansion. */ - if (ExpandFromContext(xp, str, &xp->xp_numfiles, &xp->xp_files, + if (ExpandFromContext(xp, str, &xp->xp_numfiles, (char_u ***)&xp->xp_files, options) == FAIL) { #ifdef FNAME_ILLEGAL /* Illegal file name has been silently skipped. But when there @@ -3974,7 +3974,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode } } else { // Escape the matches for use on the command line. - ExpandEscape(xp, str, xp->xp_numfiles, xp->xp_files, options); + ExpandEscape(xp, str, xp->xp_numfiles, (char_u **)xp->xp_files, options); /* * Check for matching suffixes in file names. @@ -3995,9 +3995,9 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode * expand_wildcards, only need to check the first two. */ non_suf_match = 0; - for (i = 0; i < 2; ++i) { - if (match_suffix(xp->xp_files[i])) { - ++non_suf_match; + for (i = 0; i < 2; i++) { + if (match_suffix((char_u *)xp->xp_files[i])) { + non_suf_match++; } } } @@ -4014,7 +4014,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode } } if (!(non_suf_match != 1 && mode == WILD_EXPAND_FREE)) { - ss = vim_strsave(xp->xp_files[0]); + ss = vim_strsave((char_u *)xp->xp_files[0]); } } } @@ -4025,10 +4025,10 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode size_t len = 0; for (size_t mb_len; xp->xp_files[0][len]; len += mb_len) { - mb_len = (size_t)utfc_ptr2len(&xp->xp_files[0][len]); - int c0 = utf_ptr2char(&xp->xp_files[0][len]); + mb_len = (size_t)utfc_ptr2len((char_u *)&xp->xp_files[0][len]); + int c0 = utf_ptr2char((char_u *)&xp->xp_files[0][len]); for (i = 1; i < xp->xp_numfiles; i++) { - int ci = utf_ptr2char(&xp->xp_files[i][len]); + int ci = utf_ptr2char((char_u *)&xp->xp_files[i][len]); if (p_fic && (xp->xp_context == EXPAND_DIRECTORIES || xp->xp_context == EXPAND_FILES @@ -4049,7 +4049,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode } } - ss = (char_u *)xstrndup((char *)xp->xp_files[0], len); + ss = (char_u *)xstrndup(xp->xp_files[0], len); findex = -1; // next p_wc gets first one } @@ -4099,7 +4099,7 @@ void ExpandInit(expand_T *xp) void ExpandCleanup(expand_T *xp) { if (xp->xp_numfiles >= 0) { - FreeWild(xp->xp_numfiles, xp->xp_files); + FreeWild(xp->xp_numfiles, (char_u **)xp->xp_files); xp->xp_numfiles = -1; } } @@ -4288,7 +4288,7 @@ static int showmatches(expand_T *xp, int wildmenu) } } else { num_files = xp->xp_numfiles; - files_found = xp->xp_files; + files_found = (char_u **)xp->xp_files; showtail = cmd_showtail; } @@ -4306,7 +4306,7 @@ static int showmatches(expand_T *xp, int wildmenu) compl_match_array[i].pum_text = L_SHOWFILE(i); } char_u *endpos = (showtail - ? sm_gettail(xp->xp_pattern, true) : xp->xp_pattern); + ? sm_gettail((char_u *)xp->xp_pattern, true) : (char_u *)xp->xp_pattern); if (ui_has(kUICmdline)) { compl_startcol = (int)(endpos - ccline.cmdbuff); } else { @@ -4490,14 +4490,14 @@ static int expand_showtail(expand_T *xp) return FALSE; } - end = path_tail(xp->xp_pattern); - if (end == xp->xp_pattern) { // there is no path separator - return FALSE; + end = path_tail((char_u *)xp->xp_pattern); + if (end == (char_u *)xp->xp_pattern) { // there is no path separator + return false; } - for (s = xp->xp_pattern; s < end; s++) { - /* Skip escaped wildcards. Only when the backslash is not a path - * separator, on DOS the '*' "path\*\file" must not be skipped. */ + for (s = (char_u *)xp->xp_pattern; s < end; s++) { + // Skip escaped wildcards. Only when the backslash is not a path + // separator, on DOS the '*' "path\*\file" must not be skipped. if (rem_backslash(s)) { ++s; } else if (vim_strchr((char_u *)"*?[", *s) != NULL) { @@ -4718,8 +4718,8 @@ void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline set_context_for_expression(xp, (char *)str, CMD_SIZE); } else if (use_ccline && ccline.input_fn) { xp->xp_context = ccline.xp_context; - xp->xp_pattern = ccline.cmdbuff; - xp->xp_arg = ccline.xp_arg; + xp->xp_pattern = (char *)ccline.cmdbuff; + xp->xp_arg = (char *)ccline.xp_arg; } else { while (nextcomm != NULL) { nextcomm = set_one_cmd_context(xp, nextcomm); @@ -4728,7 +4728,7 @@ void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline /* Store the string here so that call_user_expand_func() can get to them * easily. */ - xp->xp_line = str; + xp->xp_line = (char *)str; xp->xp_col = col; str[col] = old_char; @@ -4763,9 +4763,9 @@ int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char_u * } // add star to file name, or convert to regexp if not exp. files. - assert((str + col) - xp->xp_pattern >= 0); - xp->xp_pattern_len = (size_t)((str + col) - xp->xp_pattern); - file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); + assert((str + col) - (char_u *)xp->xp_pattern >= 0); + xp->xp_pattern_len = (size_t)((str + col) - (char_u *)xp->xp_pattern); + file_str = addstar((char_u *)xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); if (p_wic) { options += WILD_ICASE; @@ -5312,18 +5312,18 @@ static void *call_user_expand_func(user_expand_func_T user_expand_func, expand_T ccline.cmdbuff[ccline.cmdlen] = 0; } - pat = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); + pat = vim_strnsave((char_u *)xp->xp_pattern, xp->xp_pattern_len); args[0].v_type = VAR_STRING; args[1].v_type = VAR_STRING; args[2].v_type = VAR_NUMBER; args[3].v_type = VAR_UNKNOWN; args[0].vval.v_string = pat; - args[1].vval.v_string = xp->xp_line; + args[1].vval.v_string = (char_u *)xp->xp_line; args[2].vval.v_number = xp->xp_col; current_sctx = xp->xp_script_ctx; - void *const ret = user_expand_func(xp->xp_arg, 3, args); + void *const ret = user_expand_func((char_u *)xp->xp_arg, 3, args); current_sctx = save_current_sctx; if (ccline.cmdbuff != NULL) { @@ -6239,7 +6239,7 @@ void ex_history(exarg_T *eap) int idx; int i, j, k; char_u *end; - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; if (hislen == 0) { msg(_("'history' option is zero")); diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 539f6e3a1f..df9297dc0b 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3938,7 +3938,7 @@ char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, bool forc } break; } - xp->xp_pattern = arg; + xp->xp_pattern = (char *)arg; } return NULL; diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index a6e7ba9fc1..b2974854c1 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -641,15 +641,15 @@ void ex_hardcopy(exarg_T *eap) char *errormsg = NULL; // Expand things like "%.ps". - if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) { + if (expand_filename(eap, (char_u **)eap->cmdlinep, &errormsg) == FAIL) { if (errormsg != NULL) { emsg(errormsg); } return; } - settings.outfile = skipwhite(eap->arg + 1); + settings.outfile = skipwhite((char_u *)eap->arg + 1); } else if (*eap->arg != NUL) { - settings.arguments = eap->arg; + settings.arguments = (char_u *)eap->arg; } /* diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c index 45c7863d00..9a0173f1d2 100644 --- a/src/nvim/highlight_group.c +++ b/src/nvim/highlight_group.c @@ -1453,8 +1453,7 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg } } - (void)syn_list_header(didh, (int)(vim_strsize((char_u *)ts) + (int)STRLEN(name) - + 1), id, false); + (void)syn_list_header(didh, vim_strsize((char_u *)ts) + (int)STRLEN(name) + 1, id, false); didh = true; if (!got_int) { if (*name != NUL) { @@ -1973,7 +1972,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) { // Default: expand group names. xp->xp_context = EXPAND_HIGHLIGHT; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; include_link = 2; include_default = 1; @@ -1984,7 +1983,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) include_default = 0; if (strncmp("default", arg, (unsigned)(p - arg)) == 0) { arg = (const char *)skipwhite((const char_u *)p); - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; p = (const char *)skiptowhite((const char_u *)arg); } if (*p != NUL) { // past group name @@ -1994,11 +1993,11 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg) } if (strncmp("link", arg, (unsigned)(p - arg)) == 0 || strncmp("clear", arg, (unsigned)(p - arg)) == 0) { - xp->xp_pattern = skipwhite((const char_u *)p); - p = (const char *)skiptowhite(xp->xp_pattern); + xp->xp_pattern = (char *)skipwhite((const char_u *)p); + p = (const char *)skiptowhite((char_u *)xp->xp_pattern); if (*p != NUL) { // Past first group name. - xp->xp_pattern = skipwhite((const char_u *)p); - p = (const char *)skiptowhite(xp->xp_pattern); + xp->xp_pattern = (char *)skipwhite((const char_u *)p); + p = (const char *)skiptowhite((char_u *)xp->xp_pattern); } } if (*p != NUL) { // Past group name(s). diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 55af044658..ea1a0efec1 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -145,7 +145,7 @@ void set_context_in_cscope_cmd(expand_T *xp, const char *arg, cmdidx_T cmdidx) { // Default: expand subcommands. xp->xp_context = EXPAND_CSCOPE; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; expand_what = ((cmdidx == CMD_scscope) ? EXP_SCSCOPE_SUBCMD : EXP_CSCOPE_SUBCMD); @@ -153,8 +153,8 @@ void set_context_in_cscope_cmd(expand_T *xp, const char *arg, cmdidx_T cmdidx) if (*arg != NUL) { const char *p = (const char *)skiptowhite((const char_u *)arg); if (*p != NUL) { // Past first word. - xp->xp_pattern = skipwhite((const char_u *)p); - if (*skiptowhite(xp->xp_pattern) != NUL) { + xp->xp_pattern = (char *)skipwhite((const char_u *)p); + if (*skiptowhite((char_u *)xp->xp_pattern) != NUL) { xp->xp_context = EXPAND_NOTHING; } else if (STRNICMP(arg, "add", p - arg) == 0) { xp->xp_context = EXPAND_FILES; @@ -224,8 +224,8 @@ void ex_cstag(exarg_T *eap) switch (p_csto) { case 0: if (cs_check_for_connections()) { - ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, false, - false, *eap->cmdlinep); + ret = cs_find_common("g", eap->arg, eap->forceit, false, + false, (char_u *)(*eap->cmdlinep)); if (ret == false) { cs_free_tags(); if (msg_col) { @@ -233,32 +233,32 @@ void ex_cstag(exarg_T *eap) } if (cs_check_for_tags()) { - ret = do_tag(eap->arg, DT_JUMP, 0, eap->forceit, FALSE); + ret = do_tag((char_u *)eap->arg, DT_JUMP, 0, eap->forceit, false); } } } else if (cs_check_for_tags()) { - ret = do_tag(eap->arg, DT_JUMP, 0, eap->forceit, FALSE); + ret = do_tag((char_u *)eap->arg, DT_JUMP, 0, eap->forceit, false); } break; case 1: if (cs_check_for_tags()) { - ret = do_tag(eap->arg, DT_JUMP, 0, eap->forceit, FALSE); - if (ret == FALSE) { + ret = do_tag((char_u *)eap->arg, DT_JUMP, 0, eap->forceit, false); + if (ret == false) { if (msg_col) { msg_putchar('\n'); } if (cs_check_for_connections()) { - ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, - false, false, *eap->cmdlinep); + ret = cs_find_common("g", eap->arg, eap->forceit, + false, false, (char_u *)(*eap->cmdlinep)); if (ret == false) { cs_free_tags(); } } } } else if (cs_check_for_connections()) { - ret = cs_find_common("g", (char *)(eap->arg), eap->forceit, false, - false, *eap->cmdlinep); + ret = cs_find_common("g", eap->arg, eap->forceit, false, + false, (char_u *)(*eap->cmdlinep)); if (ret == false) { cs_free_tags(); } @@ -899,7 +899,7 @@ static int cs_find(exarg_T *eap) } pat = opt + strlen(opt) + 1; - if (pat >= (char *)eap->arg + eap_arg_len) { + if (pat >= eap->arg + eap_arg_len) { cs_usage_msg(Find); return false; } @@ -915,7 +915,7 @@ static int cs_find(exarg_T *eap) } return cs_find_common(opt, pat, eap->forceit, true, - eap->cmdidx == CMD_lcscope, *eap->cmdlinep); + eap->cmdidx == CMD_lcscope, (char_u *)(*eap->cmdlinep)); } @@ -1210,7 +1210,7 @@ static cscmd_T *cs_lookup_cmd(exarg_T *eap) // Store length of eap->arg before it gets modified by strtok(). eap_arg_len = (int)STRLEN(eap->arg); - if ((stok = strtok((char *)(eap->arg), (const char *)" ")) == NULL) { + if ((stok = strtok(eap->arg, (const char *)" ")) == NULL) { // NOLINT(runtime/threadsafe_fn) return NULL; } diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 9cdc299ea7..1777ba0a76 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -1873,7 +1873,7 @@ void nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap) char *buf = xcalloc(length, sizeof(char)); bool done = false; while (!done) { - done = uc_split_args_iter(eap->arg, length, &end, buf, &len); + done = uc_split_args_iter((char_u *)eap->arg, length, &end, buf, &len); if (len > 0) { lua_pushlstring(lstate, buf, len); lua_rawseti(lstate, -2, i); diff --git a/src/nvim/main.c b/src/nvim/main.c index 5a496a10b4..3f9e875d74 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -513,7 +513,7 @@ int main(int argc, char **argv) // Need to jump to the tag before executing the '-c command'. // Makes "vim -c '/return' -t main" work. - handle_tag(params.tagname); + handle_tag((char_u *)params.tagname); // Execute any "+", "-c" and "-S" arguments. if (params.n_commands > 0) { @@ -1131,7 +1131,7 @@ static void command_line_scan(mparm_T *parmp) } parmp->edit_type = EDIT_QF; if (argv[0][argv_idx]) { // "-q{errorfile}" - parmp->use_ef = (char_u *)argv[0] + argv_idx; + parmp->use_ef = argv[0] + argv_idx; argv_idx = -1; } else if (argc > 1) { // "-q {errorfile}" want_argument = true; @@ -1160,7 +1160,7 @@ static void command_line_scan(mparm_T *parmp) } parmp->edit_type = EDIT_TAG; if (argv[0][argv_idx]) { // "-t{tag}" - parmp->tagname = (char_u *)argv[0] + argv_idx; + parmp->tagname = argv[0] + argv_idx; argv_idx = -1; } else { // "-t {tag}" want_argument = true; @@ -1272,7 +1272,7 @@ static void command_line_scan(mparm_T *parmp) break; case 'q': // "-q {errorfile}" QuickFix mode - parmp->use_ef = (char_u *)argv[0]; + parmp->use_ef = argv[0]; break; case 'i': // "-i {shada}" use for shada @@ -1313,7 +1313,7 @@ scripterror: } case 't': // "-t {tag}" - parmp->tagname = (char_u *)argv[0]; + parmp->tagname = argv[0]; break; case 'u': // "-u {vimrc}" vim inits file parmp->use_vimrc = argv[0]; @@ -1507,7 +1507,7 @@ static void handle_quickfix(mparm_T *paramp) { if (paramp->edit_type == EDIT_QF) { if (paramp->use_ef != NULL) { - set_string_option_direct("ef", -1, paramp->use_ef, OPT_FREE, SID_CARG); + set_string_option_direct("ef", -1, (char_u *)paramp->use_ef, OPT_FREE, SID_CARG); } vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); if (qf_init(NULL, (char *)p_ef, p_efm, true, (char *)IObuff, (char *)p_menc) < 0) { diff --git a/src/nvim/main.h b/src/nvim/main.h index e55bef6e33..d5384ecc95 100644 --- a/src/nvim/main.h +++ b/src/nvim/main.h @@ -19,13 +19,13 @@ typedef struct { int n_commands; // no. of commands from + or -c char *commands[MAX_ARG_CMDS]; // commands from + or -c arg - char_u cmds_tofree[MAX_ARG_CMDS]; // commands that need free() + char cmds_tofree[MAX_ARG_CMDS]; // commands that need free() int n_pre_commands; // no. of commands from --cmd char *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument int edit_type; // type of editing to do - char_u *tagname; // tag from -t argument - char_u *use_ef; // 'errorfile' from -q argument + char *tagname; // tag from -t argument + char *use_ef; // 'errorfile' from -q argument bool input_isatty; // stdin is a terminal bool output_isatty; // stdout is a terminal diff --git a/src/nvim/mark.c b/src/nvim/mark.c index 4f4eea554a..0a9b1b26ef 100644 --- a/src/nvim/mark.c +++ b/src/nvim/mark.c @@ -651,7 +651,7 @@ static char_u *mark_line(pos_T *mp, int lead_len) */ void ex_marks(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; int i; char_u *name; pos_T *posp, *startp, *endp; @@ -668,7 +668,7 @@ void ex_marks(exarg_T *eap) if (namedfm[i].fmark.fnum != 0) { name = fm_getname(&namedfm[i].fmark, 15); } else { - name = namedfm[i].fname; + name = (char_u *)namedfm[i].fname; } if (name != NULL) { show_one_mark(i >= NMARKS ? i - NMARKS + '0' : i + 'A', @@ -767,7 +767,7 @@ void ex_delmarks(exarg_T *eap) emsg(_(e_argreq)); } else { // clear specified marks only - for (p = eap->arg; *p != NUL; ++p) { + for (p = (char_u *)eap->arg; *p != NUL; p++) { lower = ASCII_ISLOWER(*p); digit = ascii_isdigit(*p); if (lower || digit || ASCII_ISUPPER(*p)) { @@ -1311,7 +1311,7 @@ void copy_jumplist(win_T *from, win_T *to) for (i = 0; i < from->w_jumplistlen; ++i) { to->w_jumplist[i] = from->w_jumplist[i]; if (from->w_jumplist[i].fname != NULL) { - to->w_jumplist[i].fname = vim_strsave(from->w_jumplist[i].fname); + to->w_jumplist[i].fname = xstrdup(from->w_jumplist[i].fname); } } to->w_jumplistlen = from->w_jumplistlen; @@ -1665,7 +1665,7 @@ void get_global_marks(list_T *l) if (namedfm[i].fmark.fnum != 0) { name = (char *)buflist_nr2name(namedfm[i].fmark.fnum, true, true); } else { - name = (char *)namedfm[i].fname; + name = namedfm[i].fname; } if (name != NULL) { mname[1] = i >= NMARKS ? (char)(i - NMARKS + '0') : (char)(i + 'A'); diff --git a/src/nvim/mark_defs.h b/src/nvim/mark_defs.h index 51199a09e0..994ad30633 100644 --- a/src/nvim/mark_defs.h +++ b/src/nvim/mark_defs.h @@ -42,7 +42,7 @@ typedef struct filemark { /// Structure defining extended mark (mark with file name attached) typedef struct xfilemark { fmark_T fmark; ///< Actual mark. - char_u *fname; ///< File name, used when fnum == 0. + char *fname; ///< File name, used when fnum == 0. } xfmark_T; #endif // NVIM_MARK_DEFS_H diff --git a/src/nvim/match.c b/src/nvim/match.c index 86ddad0d47..e6f34c5876 100644 --- a/src/nvim/match.c +++ b/src/nvim/match.c @@ -1176,14 +1176,14 @@ void ex_match(exarg_T *eap) } if (ends_excmd(*eap->arg)) { - end = eap->arg; + end = (char_u *)eap->arg; } else if ((STRNICMP(eap->arg, "none", 4) == 0 && (ascii_iswhite(eap->arg[4]) || ends_excmd(eap->arg[4])))) { - end = eap->arg + 4; + end = (char_u *)eap->arg + 4; } else { - p = skiptowhite(eap->arg); + p = skiptowhite((char_u *)eap->arg); if (!eap->skip) { - g = vim_strnsave(eap->arg, (size_t)(p - eap->arg)); + g = vim_strnsave((char_u *)eap->arg, (size_t)(p - (char_u *)eap->arg)); } p = skipwhite(p); if (*p == NUL) { @@ -1213,5 +1213,5 @@ void ex_match(exarg_T *eap) *end = (char_u)c; } } - eap->nextcmd = find_nextcmd(end); + eap->nextcmd = (char *)find_nextcmd(end); } diff --git a/src/nvim/menu.c b/src/nvim/menu.c index 54d3f4c55d..1bde0d1be9 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -76,8 +76,8 @@ void ex_menu(exarg_T *eap) // kFalse for "menu disable vimmenu_T menuarg; - modes = get_menu_cmd_modes((char *)eap->cmd, eap->forceit, &noremap, &unmenu); - arg = (char *)eap->arg; + modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); + arg = eap->arg; for (;;) { if (STRNCMP(arg, "<script>", 8) == 0) { @@ -1022,7 +1022,7 @@ char *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char *arg, bool for xfree(path_name); xp->xp_context = expand_menus ? EXPAND_MENUNAMES : EXPAND_MENUS; - xp->xp_pattern = (char_u *)after_dot; + xp->xp_pattern = after_dot; expand_menu = menu; } else { // We're in the mapping part xp->xp_context = EXPAND_NOTHING; @@ -1470,7 +1470,7 @@ static void execute_menu(const exarg_T *eap, vimmenu_T *menu) // execute it. void ex_emenu(exarg_T *eap) { - char *saved_name = xstrdup((char *)eap->arg); + char *saved_name = xstrdup(eap->arg); vimmenu_T *menu = *get_root_menu(saved_name); char *name = saved_name; while (*name) { @@ -1531,7 +1531,7 @@ static garray_T menutrans_ga = GA_EMPTY_INIT_VALUE; */ void ex_menutranslate(exarg_T *eap) { - char *arg = (char *)eap->arg; + char *arg = eap->arg; char *from, *from_noamp, *to; if (menutrans_ga.ga_itemsize == 0) { diff --git a/src/nvim/message.c b/src/nvim/message.c index e5e661c708..f0ef4e1d4f 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -631,7 +631,7 @@ static bool emsg_multiline(const char *s, bool multiline) * when the message should be ignored completely (used for the * interrupt message). */ - if (cause_errthrow((char_u *)s, severe, &ignore)) { + if (cause_errthrow(s, severe, &ignore)) { if (!ignore) { did_emsg++; } diff --git a/src/nvim/move.c b/src/nvim/move.c index 49fa7bbf7f..11feb497ea 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -801,9 +801,9 @@ void curs_columns(win_T *wp, int may_scroll) // When cursor wraps to first char of next line in Insert // mode, the 'showbreak' string isn't shown, backup to first // column - char_u *const sbr = get_showbreak_value(wp); + char *const sbr = (char *)get_showbreak_value(wp); if (*sbr && *get_cursor_pos_ptr() == NUL - && wp->w_wcol == vim_strsize(sbr)) { + && wp->w_wcol == vim_strsize((char_u *)sbr)) { wp->w_wcol = 0; } } diff --git a/src/nvim/ops.c b/src/nvim/ops.c index f0b328dd5f..611242dd0d 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -3830,7 +3830,7 @@ void ex_display(exarg_T *eap) char_u *p; yankreg_T *yb; int name; - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; int clen; int type; diff --git a/src/nvim/option.c b/src/nvim/option.c index 1a40bac91a..16c4abfa2a 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -948,7 +948,7 @@ void ex_set(exarg_T *eap) if (eap->forceit) { flags |= OPT_ONECOLUMN; } - (void)do_set(eap->arg, flags); + (void)do_set((char_u *)eap->arg, flags); } /// Parse 'arg' for option settings. @@ -6698,12 +6698,12 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) xp->xp_context = EXPAND_SETTINGS; if (*arg == NUL) { - xp->xp_pattern = arg; + xp->xp_pattern = (char *)arg; return; } p = arg + STRLEN(arg) - 1; if (*p == ' ' && *(p - 1) != '\\') { - xp->xp_pattern = p + 1; + xp->xp_pattern = (char *)p + 1; return; } while (p > arg) { @@ -6729,7 +6729,8 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) xp->xp_context = EXPAND_BOOL_SETTINGS; p += 3; } - xp->xp_pattern = arg = p; + xp->xp_pattern = (char *)p; + arg = p; if (*arg == '<') { while (*p != '>') { if (*p++ == NUL) { // expand terminal option name @@ -6796,7 +6797,7 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) } else { expand_option_idx = opt_idx; } - xp->xp_pattern = p + 1; + xp->xp_pattern = (char *)p + 1; return; } xp->xp_context = EXPAND_NOTHING; @@ -6804,7 +6805,7 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) return; } - xp->xp_pattern = p + 1; + xp->xp_pattern = (char *)p + 1; if (flags & P_EXPAND) { p = options[opt_idx].var; @@ -6837,16 +6838,16 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) // For an option that is a list of file names, find the start of the // last file name. - for (p = arg + STRLEN(arg) - 1; p > xp->xp_pattern; p--) { + for (p = arg + STRLEN(arg) - 1; p > (char_u *)xp->xp_pattern; p--) { // count number of backslashes before ' ' or ',' if (*p == ' ' || *p == ',') { s = p; - while (s > xp->xp_pattern && *(s - 1) == '\\') { + while (s > (char_u *)xp->xp_pattern && *(s - 1) == '\\') { s--; } if ((*p == ' ' && (xp->xp_backslash == XP_BS_THREE && (p - s) < 3)) || (*p == ',' && (flags & P_COMMA) && ((p - s) & 1) == 0)) { - xp->xp_pattern = p + 1; + xp->xp_pattern = (char *)p + 1; break; } } @@ -6854,7 +6855,7 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags) // for 'spellsuggest' start at "file:" if (options[opt_idx].var == (char_u *)&p_sps && STRNCMP(p, "file:", 5) == 0) { - xp->xp_pattern = p + 5; + xp->xp_pattern = (char *)p + 5; break; } } diff --git a/src/nvim/path.c b/src/nvim/path.c index bf394ec9ab..4cbe6ebcf5 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -503,7 +503,7 @@ char *save_abs_path(const char *name) if (!path_is_absolute((char_u *)name)) { return FullName_save(name, true); } - return (char *)vim_strsave((char_u *)name); + return xstrdup(name); } /// Checks if a path has a wildcard character including '~', unless at the end. diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index f13fd11fd3..e3984ef57f 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3174,7 +3174,7 @@ void qf_list(exarg_T *eap) int i; int idx1 = 1; int idx2 = -1; - char *arg = (char *)eap->arg; + char *arg = eap->arg; int all = eap->forceit; // if not :cl!, only show // recognised errors qf_info_T *qi; @@ -4392,7 +4392,7 @@ void ex_make(exarg_T *eap) } os_remove(fname); // in case it's not unique - char *const cmd = make_get_fullcmd((char *)eap->arg, fname); + char *const cmd = make_get_fullcmd(eap->arg, fname); do_shell(cmd, 0); @@ -4401,7 +4401,7 @@ void ex_make(exarg_T *eap) res = qf_init(wp, fname, (eap->cmdidx != CMD_make && eap->cmdidx != CMD_lmake) ? p_gefm : p_efm, (eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd), - qf_cmdtitle((char *)(*eap->cmdlinep)), enc); + qf_cmdtitle(*eap->cmdlinep), enc); if (wp != NULL) { qi = GET_LOC_LIST(wp); if (qi == NULL) { @@ -5112,7 +5112,7 @@ void ex_cfile(exarg_T *eap) } } if (*eap->arg != NUL) { - set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0); + set_string_option_direct("ef", -1, (char_u *)eap->arg, OPT_FREE, 0); } char *enc = (*curbuf->b_p_menc != NUL) ? (char *)curbuf->b_p_menc : (char *)p_menc; @@ -5133,7 +5133,7 @@ void ex_cfile(exarg_T *eap) // quickfix list then a new list is created. int res = qf_init(wp, (char *)p_ef, p_efm, (eap->cmdidx != CMD_caddfile && eap->cmdidx != CMD_laddfile), - qf_cmdtitle((char *)(*eap->cmdlinep)), enc); + qf_cmdtitle(*eap->cmdlinep), enc); if (wp != NULL) { qi = GET_LOC_LIST(wp); if (qi == NULL) { @@ -5385,7 +5385,7 @@ static void vgr_jump_to_match(qf_info_T *qi, int forceit, bool *redraw_for_dummy // Jump to the directory used after loading the buffer. if (curbuf == first_match_buf && target_dir != NULL) { exarg_T ea = { - .arg = (char_u *)target_dir, + .arg = target_dir, .cmdidx = CMD_lcd, }; ex_cd(&ea); @@ -5414,7 +5414,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args) memset(args, 0, sizeof(*args)); args->regmatch.regprog = NULL; - args->qf_title = xstrdup(qf_cmdtitle((char *)(*eap->cmdlinep))); + args->qf_title = xstrdup(qf_cmdtitle(*eap->cmdlinep)); if (eap->addr_count > 0) { args->tomatch = eap->line2; @@ -5423,7 +5423,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args) } // Get the search pattern: either white-separated or enclosed in // - char *p = skip_vimgrep_pat((char *)eap->arg, &args->spat, &args->flags); + char *p = skip_vimgrep_pat(eap->arg, &args->spat, &args->flags); if (p == NULL) { emsg(_(e_invalpat)); return FAIL; @@ -5682,7 +5682,7 @@ static void restore_start_dir(char *dirname_start) // If the directory has changed, change it back by building up an // appropriate ex command and executing it. exarg_T ea = { - .arg = (char_u *)dirname_start, + .arg = dirname_start, .cmdidx = (curwin->w_localdir == NULL) ? CMD_cd : CMD_lcd, }; ex_cd(&ea); @@ -6887,8 +6887,8 @@ static int cbuffer_process_args(exarg_T *eap, buf_T **bufp, linenr_T *line1, lin if (*eap->arg == NUL) { buf = curbuf; - } else if (*skipwhite(skipdigits(eap->arg)) == NUL) { - buf = buflist_findnr(atoi((char *)eap->arg)); + } else if (*skipwhite(skipdigits((char_u *)eap->arg)) == NUL) { + buf = buflist_findnr(atoi(eap->arg)); } if (buf == NULL) { @@ -6949,7 +6949,7 @@ void ex_cbuffer(exarg_T *eap) return; } - qf_title = qf_cmdtitle((char *)(*eap->cmdlinep)); + qf_title = qf_cmdtitle(*eap->cmdlinep); if (buf->b_sfname) { vim_snprintf((char *)IObuff, IOSIZE, "%s (%s)", @@ -7035,7 +7035,7 @@ void ex_cexpr(exarg_T *eap) // Evaluate the expression. When the result is a string or a list we can // use it to fill the errorlist. typval_T tv; - if (eval0((char *)eap->arg, &tv, (char **)&eap->nextcmd, true) != FAIL) { + if (eval0(eap->arg, &tv, &eap->nextcmd, true) != FAIL) { if ((tv.v_type == VAR_STRING && tv.vval.v_string != NULL) || tv.v_type == VAR_LIST) { incr_quickfix_busy(); @@ -7043,7 +7043,7 @@ void ex_cexpr(exarg_T *eap) (eap->cmdidx != CMD_caddexpr && eap->cmdidx != CMD_laddexpr), (linenr_T)0, (linenr_T)0, - qf_cmdtitle((char *)(*eap->cmdlinep)), NULL); + qf_cmdtitle(*eap->cmdlinep), NULL); if (qf_stack_empty(qi)) { decr_quickfix_busy(); goto cleanup; @@ -7238,14 +7238,14 @@ void ex_helpgrep(exarg_T *eap) incr_quickfix_busy(); // Check for a specified language - char *const lang = check_help_lang((char *)eap->arg); + char *const lang = check_help_lang(eap->arg); regmatch_T regmatch = { - .regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING), + .regprog = vim_regcomp((char_u *)eap->arg, RE_MAGIC + RE_STRING), .rm_ic = false, }; if (regmatch.regprog != NULL) { // Create a new quickfix list. - qf_new_list(qi, qf_cmdtitle((char *)(*eap->cmdlinep))); + qf_new_list(qi, qf_cmdtitle(*eap->cmdlinep)); qf_list_T *const qfl = qf_get_curlist(qi); hgr_search_in_rtp(qfl, ®match, lang); diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 3f21fae995..43de92f497 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -35,7 +35,7 @@ void runtime_init(void) /// ":runtime [what] {name}" void ex_runtime(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *p = skiptowhite(arg); ptrdiff_t len = p - arg; int flags = eap->forceit ? DIP_ALL : 0; diff --git a/src/nvim/shada.c b/src/nvim/shada.c index a19dbac6f3..e89efe1cbc 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -1289,9 +1289,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags) XFREE_CLEAR(cur_entry.data.filemark.fname); } xfmark_T fm = (xfmark_T) { - .fname = (char_u *)(buf == NULL - ? cur_entry.data.filemark.fname - : NULL), + .fname = buf == NULL ? cur_entry.data.filemark.fname : NULL, .fmark = { .mark = cur_entry.data.filemark.mark, .fnum = (buf == NULL ? 0 : buf->b_fnum), @@ -4027,9 +4025,9 @@ static inline size_t shada_init_jumps(PossiblyFreedShadaEntry *jumps, : fm.fmark.fnum != 0) { continue; } - const char *const fname = (char *)(fm.fmark.fnum == 0 - ? (fm.fname == NULL ? NULL : fm.fname) - : buf ? buf->b_ffname : NULL); + const char *const fname = + (char *)(fm.fmark.fnum == + 0 ? (fm.fname == NULL ? NULL : (char_u *)fm.fname) : buf ? buf->b_ffname : NULL); if (fname == NULL) { continue; } diff --git a/src/nvim/sign.c b/src/nvim/sign.c index db3ce45b51..e2d40b4a21 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -1419,7 +1419,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si /// ":sign" command void ex_sign(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *p; int idx; sign_T *sp; @@ -1785,7 +1785,7 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg) // Default: expand subcommands. xp->xp_context = EXPAND_SIGN; expand_what = EXP_SUBCMD; - xp->xp_pattern = arg; + xp->xp_pattern = (char *)arg; end_subcmd = skiptowhite(arg); if (*end_subcmd == NUL) { @@ -1822,7 +1822,7 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg) // last p if (p == NULL) { // Expand last argument name (before equal sign). - xp->xp_pattern = last; + xp->xp_pattern = (char *)last; switch (cmd_idx) { case SIGNCMD_DEFINE: expand_what = EXP_DEFINE; @@ -1852,7 +1852,7 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg) } } else { // Expand last argument value (after equal sign). - xp->xp_pattern = p + 1; + xp->xp_pattern = (char *)p + 1; switch (cmd_idx) { case SIGNCMD_DEFINE: if (STRNCMP(last, "texthl", 6) == 0 diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index f4e50778cf..c1b116e498 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -4874,7 +4874,7 @@ void ex_mkspell(exarg_T *eap) { int fcount; char_u **fnames; - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; bool ascii = false; if (STRNCMP(arg, "-ascii", 6) == 0) { @@ -5501,7 +5501,7 @@ static void spell_message(const spellinfo_T *spin, char_u *str) // ":[count]spellrare {word}" void ex_spell(exarg_T *eap) { - spell_add_word(eap->arg, (int)STRLEN(eap->arg), + spell_add_word((char_u *)eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong ? SPELL_ADD_BAD : eap->cmdidx == CMD_spellrare ? SPELL_ADD_RARE : SPELL_ADD_GOOD, eap->forceit ? 0 : (int)eap->line2, diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4ba89319e7..7afabdeb96 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3032,10 +3032,10 @@ static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht, stateitem_T *cu */ static void syn_cmd_conceal(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *next; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3061,10 +3061,10 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing) */ static void syn_cmd_case(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *next; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3088,10 +3088,10 @@ static void syn_cmd_case(exarg_T *eap, int syncing) /// Handle ":syntax foldlevel" command. static void syn_cmd_foldlevel(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *arg_end; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3129,10 +3129,10 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing) */ static void syn_cmd_spell(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *next; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3164,7 +3164,7 @@ static void syn_cmd_spell(exarg_T *eap, int syncing) /// Handle ":syntax iskeyword" command. static void syn_cmd_iskeyword(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u save_chartab[32]; char_u *save_isk; @@ -3336,11 +3336,11 @@ static void syn_clear_cluster(synblock_T *block, int i) */ static void syn_cmd_clear(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *arg_end; int id; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3440,7 +3440,7 @@ static void syn_cmd_on(exarg_T *eap, int syncing) */ static void syn_cmd_reset(exarg_T *eap, int syncing) { - eap->nextcmd = check_nextcmd(eap->arg); + eap->nextcmd = (char *)check_nextcmd((char_u *)eap->arg); if (!eap->skip) { init_highlight(true, true); } @@ -3465,7 +3465,7 @@ static void syn_cmd_off(exarg_T *eap, int syncing) static void syn_cmd_onoff(exarg_T *eap, char *name) FUNC_ATTR_NONNULL_ALL { - eap->nextcmd = check_nextcmd(eap->arg); + eap->nextcmd = (char *)check_nextcmd((char_u *)eap->arg); if (!eap->skip) { did_syntax_onoff = true; char buf[100]; @@ -3479,7 +3479,7 @@ void syn_maybe_enable(void) { if (!did_syntax_onoff) { exarg_T ea; - ea.arg = (char_u *)""; + ea.arg = ""; ea.skip = false; syn_cmd_on(&ea, false); } @@ -3490,10 +3490,10 @@ void syn_maybe_enable(void) /// @param syncing when TRUE: list syncing items static void syn_cmd_list(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *arg_end; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -3569,7 +3569,7 @@ static void syn_cmd_list(exarg_T *eap, int syncing) arg = skipwhite(arg_end); } } - eap->nextcmd = check_nextcmd(arg); + eap->nextcmd = (char *)check_nextcmd(arg); } static void syn_lines_msg(void) @@ -4261,7 +4261,7 @@ static void syn_incl_toplevel(int id, int *flagsp) */ static void syn_cmd_include(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; int sgl_id = 1; char_u *group_name_end; char_u *rest; @@ -4270,7 +4270,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing) int prev_syn_inc_tag; bool source = false; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -4287,7 +4287,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing) return; } // separate_nextcmd() and expand_filename() depend on this - eap->arg = rest; + eap->arg = (char *)rest; } /* @@ -4296,7 +4296,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing) */ eap->argt |= (EX_XFILE | EX_NOSPC); separate_nextcmd(eap); - if (*eap->arg == '<' || *eap->arg == '$' || path_is_absolute(eap->arg)) { + if (*eap->arg == '<' || *eap->arg == '$' || path_is_absolute((char_u *)eap->arg)) { // For an absolute path, "$VIM/..." or "<sfile>.." we ":source" the // file. Need to expand the file name first. In other cases // ":runtime!" is used. @@ -4322,8 +4322,8 @@ static void syn_cmd_include(exarg_T *eap, int syncing) prev_toplvl_grp = curwin->w_s->b_syn_topgrp; curwin->w_s->b_syn_topgrp = sgl_id; if (source - ? do_source((char *)eap->arg, false, DOSO_NONE) == FAIL - : source_runtime((char *)eap->arg, DIP_ALL) == FAIL) { + ? do_source(eap->arg, false, DOSO_NONE) == FAIL + : source_runtime(eap->arg, DIP_ALL) == FAIL) { semsg(_(e_notopen), eap->arg); } curwin->w_s->b_syn_topgrp = prev_toplvl_grp; @@ -4335,7 +4335,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing) */ static void syn_cmd_keyword(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *group_name_end; int syn_id; char_u *rest; @@ -4432,7 +4432,7 @@ error: } if (rest != NULL) { - eap->nextcmd = check_nextcmd(rest); + eap->nextcmd = (char *)check_nextcmd(rest); } else { semsg(_(e_invarg2), arg); } @@ -4448,7 +4448,7 @@ error: /// @param syncing TRUE for ":syntax sync match .. " static void syn_cmd_match(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *group_name_end; char_u *rest; synpat_T item; // the item found in the line @@ -4485,7 +4485,7 @@ static void syn_cmd_match(exarg_T *eap, int syncing) /* * Check for trailing command and illegal trailing arguments. */ - eap->nextcmd = check_nextcmd(rest); + eap->nextcmd = (char *)check_nextcmd(rest); if (!ends_excmd(*rest) || eap->skip) { rest = NULL; } else { @@ -4546,7 +4546,7 @@ static void syn_cmd_match(exarg_T *eap, int syncing) /// @param syncing TRUE for ":syntax sync region .." static void syn_cmd_region(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *group_name_end; char_u *rest; // next arg, NULL on error char_u *key_end; @@ -4692,7 +4692,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing) * Check for trailing garbage or command. * If OK, add the item. */ - eap->nextcmd = check_nextcmd(rest); + eap->nextcmd = (char *)check_nextcmd(rest); if (!ends_excmd(*rest) || eap->skip) { rest = NULL; } else { @@ -4990,14 +4990,14 @@ static int syn_add_cluster(char_u *name) */ static void syn_cmd_cluster(exarg_T *eap, int syncing) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *group_name_end; char_u *rest; bool got_clstr = false; int opt_len; int list_op; - eap->nextcmd = find_nextcmd(arg); + eap->nextcmd = (char *)find_nextcmd(arg); if (eap->skip) { return; } @@ -5167,7 +5167,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci) */ static void syn_cmd_sync(exarg_T *eap, int syncing) { - char_u *arg_start = eap->arg; + char_u *arg_start = (char_u *)eap->arg; char_u *arg_end; char_u *key = NULL; char_u *next_arg; @@ -5267,7 +5267,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing) } next_arg = skipwhite(arg_end + 1); } else { - eap->arg = next_arg; + eap->arg = (char *)next_arg; if (STRCMP(key, "MATCH") == 0) { syn_cmd_match(eap, TRUE); } else if (STRCMP(key, "REGION") == 0) { @@ -5286,7 +5286,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing) if (illegal) { semsg(_("E404: Illegal arguments: %s"), arg_start); } else if (!finished) { - eap->nextcmd = check_nextcmd(arg_start); + eap->nextcmd = (char *)check_nextcmd(arg_start); redraw_curbuf_later(SOME_VALID); syn_stack_free_all(curwin->w_s); // Need to recompute all syntax. } @@ -5614,10 +5614,10 @@ static struct subcommand subcommands[] = */ void ex_syntax(exarg_T *eap) { - char_u *arg = eap->arg; + char_u *arg = (char_u *)eap->arg; char_u *subcmd_end; - syn_cmdlinep = eap->cmdlinep; + syn_cmdlinep = (char_u **)eap->cmdlinep; // isolate subcommand name for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); subcmd_end++) {} @@ -5631,8 +5631,8 @@ void ex_syntax(exarg_T *eap) break; } if (STRCMP(subcmd_name, (char_u *)subcommands[i].name) == 0) { - eap->arg = skipwhite(subcmd_end); - (subcommands[i].func)(eap, FALSE); + eap->arg = (char *)skipwhite(subcmd_end); + (subcommands[i].func)(eap, false); break; } } @@ -5669,7 +5669,7 @@ void ex_ownsyntax(exarg_T *eap) } // Apply the "syntax" autocommand event, this finds and loads the syntax file. - apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, true, curbuf); + apply_autocmds(EVENT_SYNTAX, (char_u *)eap->arg, curbuf->b_fname, true, curbuf); // Move value of b:current_syntax to w:current_syntax. new_value = get_var_value("b:current_syntax"); @@ -5718,7 +5718,7 @@ void reset_expand_highlight(void) void set_context_in_echohl_cmd(expand_T *xp, const char *arg) { xp->xp_context = EXPAND_HIGHLIGHT; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; include_none = 1; } @@ -5730,7 +5730,7 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg) // Default: expand subcommands. xp->xp_context = EXPAND_SYNTAX; expand_what = EXP_SUBCMD; - xp->xp_pattern = (char_u *)arg; + xp->xp_pattern = (char *)arg; include_link = 0; include_default = 0; @@ -5738,8 +5738,8 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg) if (*arg != NUL) { const char *p = (const char *)skiptowhite((const char_u *)arg); if (*p != NUL) { // Past first word. - xp->xp_pattern = skipwhite((const char_u *)p); - if (*skiptowhite(xp->xp_pattern) != NUL) { + xp->xp_pattern = (char *)skipwhite((const char_u *)p); + if (*skiptowhite((char_u *)xp->xp_pattern) != NUL) { xp->xp_context = EXPAND_NOTHING; } else if (STRNICMP(arg, "case", p - arg) == 0) { expand_what = EXP_CASE; |