aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-08-26 23:07:56 +0200
committerGitHub <noreply@github.com>2022-08-26 23:07:56 +0200
commitb0e052a8b30ce84221c3f992e111713451633b36 (patch)
tree27caaef2e0b8351eb5637d1a969229663ec2c4a8
parent6a13b8fa5460da5aa22a1c366e5252c26ed5fe1e (diff)
parent395277036014189c03b8969fc0a5cd2bdc5c8631 (diff)
downloadrneovim-b0e052a8b30ce84221c3f992e111713451633b36.tar.gz
rneovim-b0e052a8b30ce84221c3f992e111713451633b36.tar.bz2
rneovim-b0e052a8b30ce84221c3f992e111713451633b36.zip
Merge pull request #19957 from dundargoc/refactor/char_u/1
refactor: replace char_u with char
-rw-r--r--src/nvim/autocmd.c8
-rw-r--r--src/nvim/buffer.c8
-rw-r--r--src/nvim/charset.c6
-rw-r--r--src/nvim/cursor_shape.c2
-rw-r--r--src/nvim/diff.c2
-rw-r--r--src/nvim/edit.c4
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/eval/funcs.c6
-rw-r--r--src/nvim/ex_cmds.c4
-rw-r--r--src/nvim/ex_cmds2.c6
-rw-r--r--src/nvim/ex_docmd.c8
-rw-r--r--src/nvim/ex_getln.c7
-rw-r--r--src/nvim/fileio.c14
-rw-r--r--src/nvim/hardcopy.c24
-rw-r--r--src/nvim/help.c8
-rw-r--r--src/nvim/if_cscope.c4
-rw-r--r--src/nvim/insexpand.c15
-rw-r--r--src/nvim/main.c2
-rw-r--r--src/nvim/mapping.c2
-rw-r--r--src/nvim/mbyte.c2
-rw-r--r--src/nvim/memline.c8
-rw-r--r--src/nvim/message.c6
-rw-r--r--src/nvim/normal.c22
-rw-r--r--src/nvim/ops.c15
-rw-r--r--src/nvim/option.c46
-rw-r--r--src/nvim/option_defs.h252
-rw-r--r--src/nvim/optionstr.c295
-rw-r--r--src/nvim/os/env.c6
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/popupmenu.c2
-rw-r--r--src/nvim/quickfix.c14
-rw-r--r--src/nvim/runtime.c61
-rw-r--r--src/nvim/screen.c10
-rw-r--r--src/nvim/search.c6
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/spellfile.c10
-rw-r--r--src/nvim/spellsuggest.c4
-rw-r--r--src/nvim/statusline.c8
-rw-r--r--src/nvim/syntax.c141
-rw-r--r--src/nvim/tag.c2
-rw-r--r--src/nvim/ui.c4
-rw-r--r--src/nvim/version.c2
43 files changed, 526 insertions, 534 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index e970387456..2fe9df2206 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -686,7 +686,7 @@ const char *event_nr2name(event_T event)
static bool event_ignored(event_T event)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
- char *p = (char *)p_ei;
+ char *p = p_ei;
while (*p != NUL) {
if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) {
@@ -703,7 +703,7 @@ static bool event_ignored(event_T event)
// Return OK when the contents of p_ei is valid, FAIL otherwise.
int check_ei(void)
{
- char *p = (char *)p_ei;
+ char *p = p_ei;
while (*p) {
if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) {
@@ -724,8 +724,8 @@ int check_ei(void)
// Returns the old value of 'eventignore' in allocated memory.
char *au_event_disable(char *what)
{
- char *save_ei = (char *)vim_strsave(p_ei);
- char *new_ei = (char *)vim_strnsave(p_ei, STRLEN(p_ei) + STRLEN(what));
+ char *save_ei = xstrdup(p_ei);
+ char *new_ei = xstrnsave(p_ei, STRLEN(p_ei) + STRLEN(what));
if (*what == ',' && *p_ei == NUL) {
STRCPY(new_ei, what + 1);
} else {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 03b4c1bae8..24fd1b3022 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3167,14 +3167,14 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "titlestring", 0);
build_stl_str_hl(curwin, buf, sizeof(buf),
- (char *)p_titlestring, use_sandbox,
+ p_titlestring, use_sandbox,
0, maxlen, NULL, NULL);
title_str = buf;
if (called_emsg > called_emsg_before) {
set_string_option_direct("titlestring", -1, "", OPT_FREE, SID_ERROR);
}
} else {
- title_str = (char *)p_titlestring;
+ title_str = p_titlestring;
}
} else {
// Format: "fname + (path) (1 of 2) - VIM".
@@ -3281,13 +3281,13 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "iconstring", 0);
build_stl_str_hl(curwin, icon_str, sizeof(buf),
- (char *)p_iconstring, use_sandbox,
+ p_iconstring, use_sandbox,
0, 0, NULL, NULL);
if (called_emsg > called_emsg_before) {
set_string_option_direct("iconstring", -1, "", OPT_FREE, SID_ERROR);
}
} else {
- icon_str = (char *)p_iconstring;
+ icon_str = p_iconstring;
}
} else {
char *buf_p;
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index d48cadf356..dc62b85716 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -140,13 +140,13 @@ int buf_init_chartab(buf_T *buf, int global)
const char_u *p;
if (i == 0) {
// first round: 'isident'
- p = p_isi;
+ p = (char_u *)p_isi;
} else if (i == 1) {
// second round: 'isprint'
- p = p_isp;
+ p = (char_u *)p_isp;
} else if (i == 2) {
// third round: 'isfname'
- p = p_isf;
+ p = (char_u *)p_isf;
} else { // i == 3
// fourth round: 'iskeyword'
p = (char_u *)buf->b_p_isk;
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 9c33b1a806..73ad99876a 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -120,7 +120,7 @@ char *parse_shape_opt(int what)
}
}
// Repeat for all comma separated parts.
- char *modep = (char *)p_guicursor;
+ char *modep = p_guicursor;
while (modep != NULL && *modep != NUL) {
colonp = vim_strchr(modep, ':');
commap = vim_strchr(modep, ',');
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index fa1c669aaf..8107b64c83 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -2139,7 +2139,7 @@ int diffopt_changed(void)
long diff_algorithm_new = 0;
long diff_indent_heuristic = 0;
- char *p = (char *)p_dip;
+ char *p = p_dip;
while (*p != NUL) {
if (STRNCMP(p, "filler", 6) == 0) {
p += 6;
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index d9aec2fbad..55f4d77feb 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -4290,7 +4290,7 @@ static void ins_left(void)
revins_legal++;
}
revins_chars++;
- } else if (vim_strchr((char *)p_ww, '[') != NULL && curwin->w_cursor.lnum > 1) {
+ } else if (vim_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1) {
// if 'whichwrap' set for cursor in insert mode may go to previous line.
// always break undo when moving upwards/downwards, else undo may break
start_arrow(&tpos);
@@ -4383,7 +4383,7 @@ static void ins_right(void)
if (revins_chars) {
revins_chars--;
}
- } else if (vim_strchr((char *)p_ww, ']') != NULL
+ } else if (vim_strchr(p_ww, ']') != NULL
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
// if 'whichwrap' set for cursor in insert mode, may move the
// cursor to the next line
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index adcc173c71..848b1dd2cd 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -631,7 +631,7 @@ int eval_charconvert(const char *const enc_from, const char *const enc_to,
set_vim_var_string(VV_CC_TO, enc_to, -1);
set_vim_var_string(VV_FNAME_IN, fname_from, -1);
set_vim_var_string(VV_FNAME_OUT, fname_to, -1);
- if (eval_to_bool((char *)p_ccv, &err, NULL, false)) {
+ if (eval_to_bool(p_ccv, &err, NULL, false)) {
err = true;
}
set_vim_var_string(VV_CC_FROM, NULL, -1);
@@ -651,7 +651,7 @@ int eval_printexpr(const char *const fname, const char *const args)
set_vim_var_string(VV_FNAME_IN, fname, -1);
set_vim_var_string(VV_CMDARG, args, -1);
- if (eval_to_bool((char *)p_pexpr, &err, NULL, false)) {
+ if (eval_to_bool(p_pexpr, &err, NULL, false)) {
err = true;
}
set_vim_var_string(VV_FNAME_IN, NULL, -1);
@@ -671,7 +671,7 @@ void eval_diff(const char *const origfile, const char *const newfile, const char
set_vim_var_string(VV_FNAME_IN, origfile, -1);
set_vim_var_string(VV_FNAME_NEW, newfile, -1);
set_vim_var_string(VV_FNAME_OUT, outfile, -1);
- (void)eval_to_bool((char *)p_dex, &err, NULL, false);
+ (void)eval_to_bool(p_dex, &err, NULL, false);
set_vim_var_string(VV_FNAME_IN, NULL, -1);
set_vim_var_string(VV_FNAME_NEW, NULL, -1);
set_vim_var_string(VV_FNAME_OUT, NULL, -1);
@@ -8601,7 +8601,7 @@ void ex_checkhealth(exarg_T *eap)
if (vimruntime_env == NULL) {
emsg(_("E5009: $VIMRUNTIME is empty or unset"));
} else {
- bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env);
+ bool rtp_ok = NULL != strstr(p_rtp, vimruntime_env);
if (rtp_ok) {
semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
} else {
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 78298765a0..581f187140 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -8379,7 +8379,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
conv.vc_type = CONV_NONE;
enc = enc_locale();
- convert_setup(&conv, p_enc, enc);
+ convert_setup(&conv, (char_u *)p_enc, enc);
if (conv.vc_type != CONV_NONE) {
p = (char *)string_convert(&conv, (char_u *)p, NULL);
}
@@ -8393,7 +8393,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (conv.vc_type != CONV_NONE) {
xfree(p);
}
- convert_setup(&conv, enc, p_enc);
+ convert_setup(&conv, enc, (char_u *)p_enc);
if (conv.vc_type != CONV_NONE) {
rettv->vval.v_string = (char *)string_convert(&conv, (char_u *)result_buf, NULL);
} else {
@@ -8639,7 +8639,7 @@ static void f_strptime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
.vc_type = CONV_NONE,
};
char_u *enc = enc_locale();
- convert_setup(&conv, p_enc, enc);
+ convert_setup(&conv, (char_u *)p_enc, enc);
if (conv.vc_type != CONV_NONE) {
fmt = (char *)string_convert(&conv, (char_u *)fmt, NULL);
}
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 91df8c169a..a72cddc0a9 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2040,7 +2040,7 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char *fname, char *ffname, int oth
STRCPY(dir, ".");
} else {
dir = xmalloc(MAXPATHL);
- p = (char *)p_dir;
+ p = p_dir;
copy_option_part(&p, dir, MAXPATHL, ",");
}
swapname = (char *)makeswapname((char_u *)fname, (char_u *)ffname, curbuf, (char_u *)dir);
@@ -4787,7 +4787,7 @@ static int show_sub(exarg_T *eap, pos_T old_cusr, PreviewLines *preview_lines, i
long cmdpreview_ns, handle_T cmdpreview_bufnr)
FUNC_ATTR_NONNULL_ALL
{
- char *save_shm_p = (char *)vim_strsave(p_shm);
+ char *save_shm_p = xstrdup(p_shm);
PreviewLines lines = *preview_lines;
buf_T *orig_buf = curbuf;
// We keep a special-purpose buffer around, but don't assume it exists.
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 41512205dc..dbdfc2b18a 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -543,7 +543,7 @@ void ex_listdo(exarg_T *eap)
if (curwin->w_arg_idx != i || !editing_arg_idx(curwin)) {
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = (char *)vim_strsave(p_shm);
+ p_shm_save = xstrdup(p_shm);
set_option_value_give_err("shm", 0L, "", 0);
do_argfile(eap, i);
set_option_value_give_err("shm", 0L, p_shm_save, 0);
@@ -612,7 +612,7 @@ void ex_listdo(exarg_T *eap)
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
- p_shm_save = (char *)vim_strsave(p_shm);
+ p_shm_save = xstrdup(p_shm);
set_option_value_give_err("shm", 0L, "", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
set_option_value_give_err("shm", 0L, p_shm_save, 0);
@@ -635,7 +635,7 @@ void ex_listdo(exarg_T *eap)
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = (char *)vim_strsave(p_shm);
+ p_shm_save = xstrdup(p_shm);
set_option_value_give_err("shm", 0L, "", 0);
ex_cnext(eap);
set_option_value_give_err("shm", 0L, p_shm_save, 0);
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 29812dd8fe..12e2656996 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2580,7 +2580,7 @@ static void apply_cmdmod(cmdmod_T *cmod)
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL) {
// Set 'eventignore' to "all".
// First save the existing option value for restoring it later.
- cmod->cmod_save_ei = (char *)vim_strsave(p_ei);
+ cmod->cmod_save_ei = xstrdup(p_ei);
set_string_option_direct("ei", -1, "all", OPT_FREE, SID_NONE);
}
}
@@ -6954,16 +6954,16 @@ char *expand_sfile(char *arg)
/// ":rshada" and ":wshada".
static void ex_shada(exarg_T *eap)
{
- char *save_shada = (char *)p_shada;
+ char *save_shada = p_shada;
if (*p_shada == NUL) {
- p_shada = (char_u *)"'100";
+ p_shada = "'100";
}
if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) {
(void)shada_read_everything(eap->arg, eap->forceit, false);
} else {
shada_write_file(eap->arg, eap->forceit);
}
- p_shada = (char_u *)save_shada;
+ p_shada = save_shada;
}
/// Make a dialog message in "buff[DIALOG_MSG_SIZE]".
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 26ed318c10..d73a57ad75 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -634,7 +634,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
.ignore_drag_release = true,
};
CommandLineState *s = &state;
- s->save_p_icm = vim_strsave(p_icm);
+ s->save_p_icm = vim_strsave((char_u *)p_icm);
init_incsearch_state(&s->is_state);
CmdlineInfo save_ccline;
bool did_save_ccline = false;
@@ -2538,7 +2538,6 @@ char_u *get_cmdprompt(void)
int check_opt_wim(void)
{
char_u new_wim_flags[4];
- char_u *p;
int i;
int idx = 0;
@@ -2546,7 +2545,7 @@ int check_opt_wim(void)
new_wim_flags[i] = 0;
}
- for (p = p_wim; *p; p++) {
+ for (char *p = p_wim; *p; p++) {
for (i = 0; ASCII_ISALPHA(p[i]); i++) {}
if (p[i] != NUL && p[i] != ',' && p[i] != ':') {
return FAIL;
@@ -4090,7 +4089,7 @@ char *check_cedit(void)
if (*p_cedit == NUL) {
cedit_key = -1;
} else {
- n = string_to_key(p_cedit);
+ n = string_to_key((char_u *)p_cedit);
if (vim_isprintc(n)) {
return e_invarg;
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 206ef7c98d..21c1549f42 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -711,7 +711,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
fenc = curbuf->b_p_fenc; // use format from buffer
fenc_alloced = false;
} else {
- fenc_next = (char *)p_fencs; // try items in 'fileencodings'
+ fenc_next = p_fencs; // try items in 'fileencodings'
fenc = (char *)next_fenc(&fenc_next, &fenc_alloced);
}
@@ -2735,7 +2735,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
if (*p_bex == NUL) {
backup_ext = ".bak";
} else {
- backup_ext = (char *)p_bex;
+ backup_ext = p_bex;
}
if (backup_copy) {
@@ -2757,7 +2757,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
* For these reasons, the existing writable file must be truncated
* and reused. Creation of a backup COPY will be attempted.
*/
- dirp = (char *)p_bdir;
+ dirp = p_bdir;
while (*dirp) {
/*
* Isolate one directory name, using an entry in 'bdir'.
@@ -2918,7 +2918,7 @@ nobackup:
* path/fo.o.h.bak Try all directories in 'backupdir', first one
* that works is used.
*/
- dirp = (char *)p_bdir;
+ dirp = p_bdir;
while (*dirp) {
/*
* Isolate one directory name and make the backup file name.
@@ -3572,7 +3572,7 @@ restore_backup:
* the backup file our 'original' file.
*/
if (*p_pm && dobackup) {
- char *const org = modname(fname, (char *)p_pm, false);
+ char *const org = modname(fname, p_pm, false);
if (backup != NULL) {
/*
@@ -4172,7 +4172,7 @@ static bool need_conversion(const char_u *fenc)
} else {
// Ignore difference between "ansi" and "latin1", "ucs-4" and
// "ucs-4be", etc.
- enc_flags = get_fio_flags(p_enc);
+ enc_flags = get_fio_flags((char_u *)p_enc);
fenc_flags = get_fio_flags(fenc);
same_encoding = (enc_flags != 0 && fenc_flags == enc_flags);
}
@@ -4196,7 +4196,7 @@ static int get_fio_flags(const char_u *name)
int prop;
if (*name == NUL) {
- name = p_enc;
+ name = (char_u *)p_enc;
}
prop = enc_canon_props(name);
if (prop & ENC_UNICODE) {
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 7d261b751c..5451b4f4fd 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -264,7 +264,7 @@ struct prt_resfile_buffer_S {
*/
char *parse_printoptions(void)
{
- return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS);
+ return parse_list_options((char_u *)p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS);
}
/*
@@ -273,7 +273,7 @@ char *parse_printoptions(void)
*/
char *parse_printmbfont(void)
{
- return parse_list_options(p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS);
+ return parse_list_options((char_u *)p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS);
}
/*
@@ -2158,9 +2158,9 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
/*
* Set up font and encoding.
*/
- p_encoding = enc_skip(p_penc);
+ p_encoding = enc_skip((char_u *)p_penc);
if (*p_encoding == NUL) {
- p_encoding = enc_skip(p_enc);
+ p_encoding = enc_skip((char_u *)p_enc);
}
// Look for a multi-byte font that matches the encoding and character set.
@@ -2179,7 +2179,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
p_mbenc_first = p_mbenc;
effective_cmap = cmap;
}
- if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar)) {
+ if (prt_match_charset(p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar)) {
break;
}
}
@@ -2330,7 +2330,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
* Set up the font size.
*/
fontsize = PRT_PS_DEFAULT_FONTSIZE;
- for (p = p_pfn; (p = (char_u *)vim_strchr((char *)p, ':')) != NULL; p++) {
+ for (p = (char_u *)p_pfn; (p = (char_u *)vim_strchr((char *)p, ':')) != NULL; p++) {
if (p[1] == 'h' && ascii_isdigit(p[2])) {
fontsize = atoi((char *)p + 2);
}
@@ -2594,13 +2594,13 @@ bool mch_print_begin(prt_settings_T *psettings)
// that cannot be found then default to "latin1".
// Note: VIM specific encoding header is always skipped.
if (!prt_out_mbyte) {
- p_encoding = (char *)enc_skip(p_penc);
+ p_encoding = (char *)enc_skip((char_u *)p_penc);
if (*p_encoding == NUL
|| !prt_find_resource(p_encoding, &res_encoding)) {
// 'printencoding' not set or not supported - find alternate
int props;
- p_encoding = (char *)enc_skip(p_enc);
+ p_encoding = (char *)enc_skip((char_u *)p_enc);
props = enc_canon_props((char_u *)p_encoding);
if (!(props & ENC_8BIT)
|| !prt_find_resource(p_encoding, &res_encoding)) {
@@ -2620,9 +2620,9 @@ bool mch_print_begin(prt_settings_T *psettings)
// For the moment there are no checks on encoding resource files to
// perform
} else {
- p_encoding = (char *)enc_skip(p_penc);
+ p_encoding = (char *)enc_skip((char_u *)p_penc);
if (*p_encoding == NUL) {
- p_encoding = (char *)enc_skip(p_enc);
+ p_encoding = (char *)enc_skip((char_u *)p_enc);
}
if (prt_use_courier) {
// Include ASCII range encoding vector
@@ -2640,9 +2640,9 @@ bool mch_print_begin(prt_settings_T *psettings)
}
prt_conv.vc_type = CONV_NONE;
- if (!(enc_canon_props(p_enc) & enc_canon_props((char_u *)p_encoding) & ENC_8BIT)) {
+ if (!(enc_canon_props((char_u *)p_enc) & enc_canon_props((char_u *)p_encoding) & ENC_8BIT)) {
// Set up encoding conversion if required
- if (convert_setup(&prt_conv, p_enc, (char_u *)p_encoding) == FAIL) {
+ if (convert_setup(&prt_conv, (char_u *)p_enc, (char_u *)p_encoding) == FAIL) {
semsg(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
return false;
diff --git a/src/nvim/help.c b/src/nvim/help.c
index 5b2d3a17a3..19bf67c890 100644
--- a/src/nvim/help.c
+++ b/src/nvim/help.c
@@ -137,7 +137,7 @@ void ex_help(exarg_T *eap)
} else {
// There is no help window yet.
// Try to open the file specified by the "helpfile" option.
- if ((helpfd = os_fopen((char *)p_hf, READBIN)) == NULL) {
+ if ((helpfd = os_fopen(p_hf, READBIN)) == NULL) {
smsg(_("Sorry, help file \"%s\" not found"), p_hf);
goto erret;
}
@@ -701,7 +701,7 @@ void fix_help_buffer(void)
// Go through all directories in 'runtimepath', skipping
// $VIMRUNTIME.
- char *p = (char *)p_rtp;
+ char *p = p_rtp;
while (*p != NUL) {
copy_option_part(&p, (char *)NameBuff, MAXPATHL, ",");
char *const rt = vim_getenv("VIMRUNTIME");
@@ -804,7 +804,7 @@ void fix_help_buffer(void)
vc.vc_type = CONV_NONE;
convert_setup(&vc,
(char_u *)(this_utf == kTrue ? "utf-8" : "latin1"),
- p_enc);
+ (char_u *)p_enc);
if (vc.vc_type == CONV_NONE) {
// No conversion needed.
cp = (char *)IObuff;
@@ -1163,7 +1163,7 @@ void ex_helptags(exarg_T *eap)
}
if (STRCMP(eap->arg, "ALL") == 0) {
- do_in_path(p_rtp, "doc", DIP_ALL + DIP_DIR, helptags_cb, &add_help_tags);
+ do_in_path((char_u *)p_rtp, "doc", DIP_ALL + DIP_DIR, helptags_cb, &add_help_tags);
} else {
ExpandInit(&xpc);
xpc.xp_context = EXPAND_DIRECTORIES;
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index e32b58fbcb..50ec444d51 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -757,7 +757,7 @@ err_closing:
#endif
// expand the cscope exec for env var's
prog = xmalloc(MAXPATHL + 1);
- expand_env(p_csprg, (char_u *)prog, MAXPATHL);
+ expand_env((char_u *)p_csprg, (char_u *)prog, MAXPATHL);
// alloc space to hold the cscope command
size_t len = strlen(prog) + strlen(csinfo[i].fname) + 32;
@@ -953,7 +953,7 @@ static bool cs_find_common(char *opt, char *pat, int forceit, int verbose, bool
cmdletter = opt[0];
}
- qfpos = vim_strchr((char *)p_csqf, cmdletter);
+ qfpos = vim_strchr(p_csqf, cmdletter);
if (qfpos != NULL) {
qfpos++;
// next symbol must be + or -
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 7d17a284e5..e6c13f315e 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -1008,10 +1008,10 @@ void completeopt_was_set(void)
{
compl_no_insert = false;
compl_no_select = false;
- if (strstr((char *)p_cot, "noselect") != NULL) {
+ if (strstr(p_cot, "noselect") != NULL) {
compl_no_select = true;
}
- if (strstr((char *)p_cot, "noinsert") != NULL) {
+ if (strstr(p_cot, "noinsert") != NULL) {
compl_no_insert = true;
}
}
@@ -1037,7 +1037,7 @@ bool pum_wanted(void)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
// "completeopt" must contain "menu" or "menuone"
- return vim_strchr((char *)p_cot, 'm') != NULL;
+ return vim_strchr(p_cot, 'm') != NULL;
}
/// Check that there are two or more matches to be shown in the popup menu.
@@ -1056,7 +1056,7 @@ static bool pum_enough_matches(void)
compl = compl->cp_next;
} while (!is_first_match(compl));
- if (strstr((char *)p_cot, "menuone") != NULL) {
+ if (strstr(p_cot, "menuone") != NULL) {
return i >= 1;
}
return i >= 2;
@@ -2105,7 +2105,7 @@ bool ins_compl_prep(int c)
// Set "compl_get_longest" when finding the first matches.
if (ctrl_x_mode_not_defined_yet()
|| (ctrl_x_mode_normal() && !compl_started)) {
- compl_get_longest = (strstr((char *)p_cot, "longest") != NULL);
+ compl_get_longest = (strstr(p_cot, "longest") != NULL);
compl_used_match = true;
}
@@ -2229,7 +2229,7 @@ static char_u *get_complete_funcname(int type)
case CTRL_X_OMNI:
return (char_u *)curbuf->b_p_ofu;
case CTRL_X_THESAURUS:
- return *curbuf->b_p_tsrfu == NUL ? p_tsrfu : (char_u *)curbuf->b_p_tsrfu;
+ return *curbuf->b_p_tsrfu == NUL ? (char_u *)p_tsrfu : (char_u *)curbuf->b_p_tsrfu;
default:
return (char_u *)"";
}
@@ -2825,7 +2825,8 @@ static void get_next_dict_tsr_completion(int compl_type, char_u *dict, int dict_
ins_compl_dictionaries(dict != NULL ? dict
: (compl_type == CTRL_X_THESAURUS
? (*curbuf->b_p_tsr == NUL ? p_tsr : (char_u *)curbuf->b_p_tsr)
- : (*curbuf->b_p_dict == NUL ? p_dict : (char_u *)curbuf->b_p_dict)),
+ : (*curbuf->b_p_dict ==
+ NUL ? (char_u *)p_dict : (char_u *)curbuf->b_p_dict)),
(char_u *)compl_pattern,
dict != NULL ? dict_f : 0,
compl_type == CTRL_X_THESAURUS);
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6fc70dec2d..efa1f8e350 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1733,7 +1733,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
if (i == 1) {
char buf[100];
- p_shm_save = xstrdup((char *)p_shm);
+ p_shm_save = xstrdup(p_shm);
snprintf(buf, sizeof(buf), "F%s", p_shm);
set_option_value_give_err("shm", 0L, buf, 0);
}
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index f7f1de13c4..ef44d71165 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -2322,7 +2322,7 @@ void langmap_set(void)
ga_clear(&langmap_mapga); // clear the previous map first
langmap_init(); // back to one-to-one map
- for (p = p_langmap; p[0] != NUL;) {
+ for (p = (char_u *)p_langmap; p[0] != NUL;) {
for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
MB_PTR_ADV(p2)) {
if (p2[0] == '\\' && p2[1] != NUL) {
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index ad8718742f..9213457608 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -1936,7 +1936,7 @@ void utf_find_illegal(void)
// 'encoding' is "utf-8" but we are editing a 8-bit encoded file,
// possibly a utf-8 file with illegal bytes. Setup for conversion
// from utf-8 to 'fileencoding'.
- convert_setup(&vimconv, p_enc, (char_u *)curbuf->b_p_fenc);
+ convert_setup(&vimconv, (char_u *)p_enc, (char_u *)curbuf->b_p_fenc);
}
curwin->w_cursor.coladd = 0;
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 014d9a1d18..2913d0d271 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -399,7 +399,7 @@ void ml_setname(buf_T *buf)
}
// Try all directories in the 'directory' option.
- dirp = (char *)p_dir;
+ dirp = p_dir;
bool found_existing_dir = false;
for (;;) {
if (*dirp == NUL) { // tried all directories, fail
@@ -490,7 +490,7 @@ void ml_open_file(buf_T *buf)
}
// Try all directories in 'directory' option.
- dirp = (char *)p_dir;
+ dirp = p_dir;
bool found_existing_dir = false;
for (;;) {
if (*dirp == NUL) {
@@ -1294,7 +1294,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
// Do the loop for every directory in 'directory'.
// First allocate some memory to put the directory name in.
dir_name = xmalloc(STRLEN(p_dir) + 1);
- dirp = (char *)p_dir;
+ dirp = p_dir;
while (*dirp) {
// Isolate a directory name from *dirp and put it in dir_name (we know
// it is large enough, so use 31000 for length).
@@ -3494,7 +3494,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// give the ATTENTION message when there is an old swap file
// for the current file, and the buffer was not recovered.
if (differ == false && !(curbuf->b_flags & BF_RECOVERED)
- && vim_strchr((char *)p_shm, SHM_ATTENTION) == NULL) {
+ && vim_strchr(p_shm, SHM_ATTENTION) == NULL) {
int choice = 0;
process_still_running = false;
diff --git a/src/nvim/message.c b/src/nvim/message.c
index aa5e556180..40de8a2bc6 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -640,8 +640,8 @@ void msg_source(int attr)
/// If "emsg_skip" is set: never do error messages.
int emsg_not_now(void)
{
- if ((emsg_off > 0 && vim_strchr((char *)p_debug, 'm') == NULL
- && vim_strchr((char *)p_debug, 't') == NULL)
+ if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL
+ && vim_strchr(p_debug, 't') == NULL)
|| emsg_skip > 0) {
return true;
}
@@ -665,7 +665,7 @@ static bool emsg_multiline(const char *s, bool multiline)
bool severe = emsg_severe;
emsg_severe = false;
- if (!emsg_off || vim_strchr((char *)p_debug, 't') != NULL) {
+ if (!emsg_off || vim_strchr(p_debug, 't') != NULL) {
// Cause a throw of an error exception if appropriate. Don't display
// the error message in this case. (If no matching catch clause will
// be found, the message will be displayed later on.) "ignore" is set
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 743297eb9d..93ee49b0a4 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2653,11 +2653,11 @@ void clear_showcmd(void)
lines = bot - top + 1;
if (VIsual_mode == Ctrl_V) {
- char_u *const saved_sbr = p_sbr;
+ char *const saved_sbr = p_sbr;
char *const saved_w_sbr = curwin->w_p_sbr;
// Make 'sbr' empty for a moment to get the correct size.
- p_sbr = (char_u *)empty_option;
+ p_sbr = empty_option;
curwin->w_p_sbr = empty_option;
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
p_sbr = saved_sbr;
@@ -4567,9 +4567,9 @@ static void nv_right(cmdarg_T *cap)
// <Space> wraps to next line if 'whichwrap' has 's'.
// 'l' wraps to next line if 'whichwrap' has 'l'.
// CURS_RIGHT wraps to next line if 'whichwrap' has '>'.
- if (((cap->cmdchar == ' ' && vim_strchr((char *)p_ww, 's') != NULL)
- || (cap->cmdchar == 'l' && vim_strchr((char *)p_ww, 'l') != NULL)
- || (cap->cmdchar == K_RIGHT && vim_strchr((char *)p_ww, '>') != NULL))
+ if (((cap->cmdchar == ' ' && vim_strchr(p_ww, 's') != NULL)
+ || (cap->cmdchar == 'l' && vim_strchr(p_ww, 'l') != NULL)
+ || (cap->cmdchar == K_RIGHT && vim_strchr(p_ww, '>') != NULL))
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
// When deleting we also count the NL as a character.
// Set cap->oap->inclusive when last char in the line is
@@ -4637,9 +4637,9 @@ static void nv_left(cmdarg_T *cap)
// 'h' wraps to previous line if 'whichwrap' has 'h'.
// CURS_LEFT wraps to previous line if 'whichwrap' has '<'.
if ((((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H)
- && vim_strchr((char *)p_ww, 'b') != NULL)
- || (cap->cmdchar == 'h' && vim_strchr((char *)p_ww, 'h') != NULL)
- || (cap->cmdchar == K_LEFT && vim_strchr((char *)p_ww, '<') != NULL))
+ && vim_strchr(p_ww, 'b') != NULL)
+ || (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL)
+ || (cap->cmdchar == K_LEFT && vim_strchr(p_ww, '<') != NULL))
&& curwin->w_cursor.lnum > 1) {
curwin->w_cursor.lnum--;
coladvance(MAXCOL);
@@ -5553,7 +5553,7 @@ static void n_swapchar(cmdarg_T *cap)
return;
}
- if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr((char *)p_ww, '~') == NULL) {
+ if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL) {
clearopbeep(cap->oap);
return;
}
@@ -5569,7 +5569,7 @@ static void n_swapchar(cmdarg_T *cap)
did_change |= swapchar(cap->oap->op_type, &curwin->w_cursor);
inc_cursor();
if (gchar_cursor() == NUL) {
- if (vim_strchr((char *)p_ww, '~') != NULL
+ if (vim_strchr(p_ww, '~') != NULL
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
curwin->w_cursor.lnum++;
curwin->w_cursor.col = 0;
@@ -5901,7 +5901,7 @@ void start_selection(void)
void may_start_select(int c)
{
VIsual_select = (c == 'o' || (stuff_empty() && typebuf_typed()))
- && vim_strchr((char *)p_slm, c) != NULL;
+ && vim_strchr(p_slm, c) != NULL;
}
/// Start Visual mode "c".
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 79450acbd6..0fc15b9382 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5334,17 +5334,16 @@ void cursor_pos_info(dict_T *dict)
}
if (l_VIsual_mode == Ctrl_V) {
- char_u *const saved_sbr = p_sbr;
+ char *const saved_sbr = p_sbr;
char *const saved_w_sbr = curwin->w_p_sbr;
// Make 'sbr' empty for a moment to get the correct size.
- p_sbr = (char_u *)empty_option;
+ p_sbr = empty_option;
curwin->w_p_sbr = empty_option;
oparg.is_VIsual = true;
oparg.motion_type = kMTBlockWise;
oparg.op_type = OP_NOP;
- getvcols(curwin, &min_pos, &max_pos,
- &oparg.start_vcol, &oparg.end_vcol);
+ getvcols(curwin, &min_pos, &max_pos, &oparg.start_vcol, &oparg.end_vcol);
p_sbr = saved_sbr;
curwin->w_p_sbr = saved_w_sbr;
if (curwin->w_curswant == MAXCOL) {
@@ -5507,14 +5506,14 @@ void cursor_pos_info(dict_T *dict)
}
if (dict == NULL) {
// Don't shorten this message, the user asked for it.
- p = p_shm;
- p_shm = (char_u *)"";
+ p = (char_u *)p_shm;
+ p_shm = "";
if (p_ch < 1) {
msg_start();
msg_scroll = true;
}
msg((char *)IObuff);
- p_shm = p;
+ p_shm = (char *)p;
}
}
@@ -5589,7 +5588,7 @@ static Callback opfunc_cb;
/// @return OK or FAIL
int set_operatorfunc_option(void)
{
- return option_set_callback_func(p_opfunc, &opfunc_cb);
+ return option_set_callback_func((char_u *)p_opfunc, &opfunc_cb);
}
#if defined(EXITFREE)
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 95c3ccf71c..3a5550ffc0 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -439,7 +439,7 @@ void set_init_1(bool clean_arg)
#ifdef HAVE_WORKING_LIBINTL
// GNU gettext 0.10.37 supports this feature: set the codeset used for
// translated messages independently from the current locale.
- (void)bind_textdomain_codeset(PROJECT_NAME, (char *)p_enc);
+ (void)bind_textdomain_codeset(PROJECT_NAME, p_enc);
#endif
// Set the default for 'helplang'.
@@ -1483,7 +1483,7 @@ int do_set(char *arg, int opt_flags)
// for ":set" on local options. Note: when setting
// 'syntax' or 'filetype' autocommands may be
// triggered that can cause havoc.
- errmsg = did_set_string_option(opt_idx, (char_u **)varp, oldval,
+ errmsg = did_set_string_option(opt_idx, (char **)varp, (char *)oldval,
errbuf, sizeof(errbuf),
opt_flags, &value_checked);
@@ -1699,16 +1699,14 @@ int get_shada_parameter(int type)
/// Return NULL if the parameter is not specified in the string.
char_u *find_shada_parameter(int type)
{
- char_u *p;
-
- for (p = p_shada; *p; p++) {
+ for (char *p = p_shada; *p; p++) {
if (*p == type) {
- return p + 1;
+ return (char_u *)p + 1;
}
if (*p == 'n') { // 'n' is always the last one
break;
}
- p = (char_u *)vim_strchr((char *)p, ','); // skip until next ','
+ p = vim_strchr(p, ','); // skip until next ','
if (p == NULL) { // hit the end without finding parameter
break;
}
@@ -1745,7 +1743,7 @@ static char_u *option_expand(int opt_idx, char_u *val)
*/
expand_env_esc(val, NameBuff, MAXPATHL,
(char_u **)options[opt_idx].var == &p_tags, false,
- (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
+ (char_u **)options[opt_idx].var == (char_u **)&p_sps ? (char_u *)"file:" :
NULL);
if (STRCMP(NameBuff, val) == 0) { // they are the same
return NULL;
@@ -2883,7 +2881,7 @@ bool set_tty_option(const char *name, char *value)
void set_tty_background(const char *value)
{
- if (option_was_set("bg") || strequal((char *)p_bg, value)) {
+ if (option_was_set("bg") || strequal(p_bg, value)) {
// background is already set... ignore
return;
}
@@ -4449,7 +4447,7 @@ void buf_copy_options(buf_T *buf, int flags)
if (!buf->b_p_initialized) {
free_buf_options(buf, true);
buf->b_p_ro = false; // don't copy readonly
- buf->b_p_fenc = (char *)vim_strsave(p_fenc);
+ buf->b_p_fenc = xstrdup(p_fenc);
switch (*p_ffs) {
case 'm':
buf->b_p_ff = xstrdup(FF_MAC);
@@ -4461,7 +4459,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_ff = xstrdup(FF_UNIX);
break;
default:
- buf->b_p_ff = (char *)vim_strsave(p_ff);
+ buf->b_p_ff = xstrdup(p_ff);
break;
}
buf->b_p_bh = empty_option;
@@ -4512,9 +4510,9 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_csl = vim_strsave(p_csl);
COPY_OPT_SCTX(buf, BV_CSL);
#endif
- buf->b_p_cfu = (char *)vim_strsave(p_cfu);
+ buf->b_p_cfu = xstrdup(p_cfu);
COPY_OPT_SCTX(buf, BV_CFU);
- buf->b_p_ofu = (char *)vim_strsave(p_ofu);
+ buf->b_p_ofu = xstrdup(p_ofu);
COPY_OPT_SCTX(buf, BV_OFU);
buf->b_p_tfu = (char *)vim_strsave(p_tfu);
COPY_OPT_SCTX(buf, BV_TFU);
@@ -4531,7 +4529,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_vsts_nopaste = p_vsts_nopaste
? (char *)vim_strsave(p_vsts_nopaste)
: NULL;
- buf->b_p_com = (char *)vim_strsave(p_com);
+ buf->b_p_com = xstrdup(p_com);
COPY_OPT_SCTX(buf, BV_COM);
buf->b_p_cms = (char *)vim_strsave(p_cms);
COPY_OPT_SCTX(buf, BV_CMS);
@@ -4551,18 +4549,18 @@ void buf_copy_options(buf_T *buf, int flags)
COPY_OPT_SCTX(buf, BV_CI);
buf->b_p_cin = p_cin;
COPY_OPT_SCTX(buf, BV_CIN);
- buf->b_p_cink = (char *)vim_strsave(p_cink);
+ buf->b_p_cink = xstrdup(p_cink);
COPY_OPT_SCTX(buf, BV_CINK);
- buf->b_p_cino = (char *)vim_strsave(p_cino);
+ buf->b_p_cino = xstrdup(p_cino);
COPY_OPT_SCTX(buf, BV_CINO);
- buf->b_p_cinsd = (char *)vim_strsave(p_cinsd);
+ buf->b_p_cinsd = xstrdup(p_cinsd);
COPY_OPT_SCTX(buf, BV_CINSD);
// Don't copy 'filetype', it must be detected
buf->b_p_ft = empty_option;
buf->b_p_pi = p_pi;
COPY_OPT_SCTX(buf, BV_PI);
- buf->b_p_cinw = (char *)vim_strsave(p_cinw);
+ buf->b_p_cinw = xstrdup(p_cinw);
COPY_OPT_SCTX(buf, BV_CINW);
buf->b_p_lisp = p_lisp;
COPY_OPT_SCTX(buf, BV_LISP);
@@ -4587,7 +4585,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_fp = empty_option;
buf->b_p_fex = (char *)vim_strsave(p_fex);
COPY_OPT_SCTX(buf, BV_FEX);
- buf->b_p_sua = (char *)vim_strsave(p_sua);
+ buf->b_p_sua = xstrdup(p_sua);
COPY_OPT_SCTX(buf, BV_SUA);
buf->b_p_keymap = (char *)vim_strsave(p_keymap);
COPY_OPT_SCTX(buf, BV_KMAP);
@@ -4642,7 +4640,7 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_vts_array = NULL;
}
} else {
- buf->b_p_isk = (char *)vim_strsave(p_isk);
+ buf->b_p_isk = xstrdup(p_isk);
COPY_OPT_SCTX(buf, BV_ISK);
did_isk = true;
buf->b_p_ts = p_ts;
@@ -5052,8 +5050,8 @@ static int wc_use_keyname(char_u *varp, long *wcp)
bool shortmess(int x)
{
return (p_shm != NULL
- && (vim_strchr((char *)p_shm, x) != NULL
- || (vim_strchr((char *)p_shm, 'a') != NULL
+ && (vim_strchr(p_shm, x) != NULL
+ || (vim_strchr(p_shm, 'a') != NULL
&& vim_strchr((char *)SHM_ALL_ABBREVIATIONS, x) != NULL)));
}
@@ -5354,7 +5352,7 @@ bool can_bs(int what)
case '0':
return false;
}
- return vim_strchr((char *)p_bs, what) != NULL;
+ return vim_strchr(p_bs, what) != NULL;
}
/// Get the local or global value of 'backupcopy'.
@@ -5379,7 +5377,7 @@ char_u *get_showbreak_value(win_T *const win)
FUNC_ATTR_WARN_UNUSED_RESULT
{
if (win->w_p_sbr == NULL || *win->w_p_sbr == NUL) {
- return p_sbr;
+ return (char_u *)p_sbr;
}
if (STRCMP(win->w_p_sbr, "NONE") == 0) {
return (char_u *)empty_option;
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index f9848cb792..59b8485272 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -384,7 +384,7 @@ enum {
*/
EXTERN long p_aleph; // 'aleph'
-EXTERN char_u *p_ambw; ///< 'ambiwidth'
+EXTERN char *p_ambw; ///< 'ambiwidth'
EXTERN int p_acd; ///< 'autochdir'
EXTERN int p_ai; ///< 'autoindent'
EXTERN int p_bin; ///< 'binary'
@@ -392,29 +392,29 @@ EXTERN int p_bomb; ///< 'bomb'
EXTERN int p_bl; ///< 'buflisted'
EXTERN int p_cin; ///< 'cindent'
EXTERN long p_channel; ///< 'channel'
-EXTERN char_u *p_cink; ///< 'cinkeys'
-EXTERN char_u *p_cinsd; ///< 'cinscopedecls'
-EXTERN char_u *p_cinw; ///< 'cinwords'
-EXTERN char_u *p_cfu; ///< 'completefunc'
-EXTERN char_u *p_ofu; ///< 'omnifunc'
-EXTERN char_u *p_tsrfu; ///< 'thesaurusfunc'
+EXTERN char *p_cink; ///< 'cinkeys'
+EXTERN char *p_cinsd; ///< 'cinscopedecls'
+EXTERN char *p_cinw; ///< 'cinwords'
+EXTERN char *p_cfu; ///< 'completefunc'
+EXTERN char *p_ofu; ///< 'omnifunc'
+EXTERN char *p_tsrfu; ///< 'thesaurusfunc'
EXTERN int p_ci; ///< 'copyindent'
EXTERN int p_ar; // 'autoread'
EXTERN int p_aw; // 'autowrite'
EXTERN int p_awa; // 'autowriteall'
-EXTERN char_u *p_bs; // 'backspace'
-EXTERN char_u *p_bg; // 'background'
+EXTERN char *p_bs; // 'backspace'
+EXTERN char *p_bg; // 'background'
EXTERN int p_bk; // 'backup'
-EXTERN char_u *p_bkc; // 'backupcopy'
+EXTERN char *p_bkc; // 'backupcopy'
EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy'
#define BKC_YES 0x001
#define BKC_AUTO 0x002
#define BKC_NO 0x004
#define BKC_BREAKSYMLINK 0x008
#define BKC_BREAKHARDLINK 0x010
-EXTERN char_u *p_bdir; // 'backupdir'
-EXTERN char_u *p_bex; // 'backupext'
-EXTERN char_u *p_bo; // 'belloff'
+EXTERN char *p_bdir; // 'backupdir'
+EXTERN char *p_bex; // 'backupext'
+EXTERN char *p_bo; // 'belloff'
EXTERN char breakat_flags[256]; // which characters are in 'breakat'
EXTERN unsigned bo_flags;
@@ -443,16 +443,16 @@ EXTERN char_u *p_bsk; // 'backupskip'
EXTERN char_u *p_breakat; // 'breakat'
EXTERN char_u *p_bh; ///< 'bufhidden'
EXTERN char_u *p_bt; ///< 'buftype'
-EXTERN char_u *p_cmp; // 'casemap'
+EXTERN char *p_cmp; // 'casemap'
EXTERN unsigned cmp_flags;
#define CMP_INTERNAL 0x001
#define CMP_KEEPASCII 0x002
-EXTERN char_u *p_enc; // 'encoding'
-EXTERN int p_deco; // 'delcombine'
-EXTERN char_u *p_ccv; // 'charconvert'
-EXTERN char_u *p_cino; ///< 'cinoptions'
-EXTERN char_u *p_cedit; // 'cedit'
-EXTERN char_u *p_cb; // 'clipboard'
+EXTERN char *p_enc; // 'encoding'
+EXTERN int p_deco; // 'delcombine'
+EXTERN char *p_ccv; // 'charconvert'
+EXTERN char *p_cino; ///< 'cinoptions'
+EXTERN char *p_cedit; // 'cedit'
+EXTERN char *p_cb; // 'clipboard'
EXTERN unsigned cb_flags;
#define CB_UNNAMED 0x001
#define CB_UNNAMEDPLUS 0x002
@@ -463,33 +463,33 @@ EXTERN char_u *p_cms; ///< 'commentstring'
EXTERN char_u *p_cpt; ///< 'complete'
EXTERN long p_columns; // 'columns'
EXTERN int p_confirm; // 'confirm'
-EXTERN char_u *p_cot; // 'completeopt'
+EXTERN char *p_cot; // 'completeopt'
#ifdef BACKSLASH_IN_FILENAME
EXTERN char_u *p_csl; // 'completeslash'
#endif
EXTERN long p_pb; // 'pumblend'
EXTERN long p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth'
-EXTERN char_u *p_com; ///< 'comments'
+EXTERN char *p_com; ///< 'comments'
EXTERN char *p_cpo; // 'cpoptions'
-EXTERN char_u *p_csprg; // 'cscopeprg'
+EXTERN char *p_csprg; // 'cscopeprg'
EXTERN int p_csre; // 'cscoperelative'
-EXTERN char_u *p_csqf; // 'cscopequickfix'
+EXTERN char *p_csqf; // 'cscopequickfix'
#define CSQF_CMDS "sgdctefia"
#define CSQF_FLAGS "+-0"
EXTERN int p_cst; // 'cscopetag'
EXTERN long p_csto; // 'cscopetagorder'
EXTERN long p_cspc; // 'cscopepathcomp'
EXTERN int p_csverbose; // 'cscopeverbose'
-EXTERN char_u *p_debug; // 'debug'
-EXTERN char_u *p_def; // 'define'
-EXTERN char_u *p_inc;
-EXTERN char_u *p_dip; // 'diffopt'
-EXTERN char_u *p_dex; // 'diffexpr'
-EXTERN char_u *p_dict; // 'dictionary'
+EXTERN char *p_debug; // 'debug'
+EXTERN char *p_def; // 'define'
+EXTERN char *p_inc;
+EXTERN char *p_dip; // 'diffopt'
+EXTERN char *p_dex; // 'diffexpr'
+EXTERN char *p_dict; // 'dictionary'
EXTERN int p_dg; // 'digraph'
-EXTERN char_u *p_dir; // 'directory'
-EXTERN char_u *p_dy; // 'display'
+EXTERN char *p_dir; // 'directory'
+EXTERN char *p_dy; // 'display'
EXTERN unsigned dy_flags;
#define DY_LASTLINE 0x001
#define DY_TRUNCATE 0x002
@@ -497,30 +497,30 @@ EXTERN unsigned dy_flags;
// code should use msg_use_msgsep() to check if msgsep is active
#define DY_MSGSEP 0x008
EXTERN int p_ed; // 'edcompatible'
-EXTERN char_u *p_ead; // 'eadirection'
+EXTERN char *p_ead; // 'eadirection'
EXTERN int p_emoji; // 'emoji'
EXTERN int p_ea; // 'equalalways'
-EXTERN char_u *p_ep; // 'equalprg'
+EXTERN char_u *p_ep; // 'equalprg'
EXTERN int p_eb; // 'errorbells'
-EXTERN char_u *p_ef; // 'errorfile'
-EXTERN char *p_efm; // 'errorformat'
-EXTERN char *p_gefm; // 'grepformat'
-EXTERN char_u *p_gp; // 'grepprg'
+EXTERN char_u *p_ef; // 'errorfile'
+EXTERN char *p_efm; // 'errorformat'
+EXTERN char *p_gefm; // 'grepformat'
+EXTERN char_u *p_gp; // 'grepprg'
EXTERN int p_eol; ///< 'endofline'
-EXTERN char_u *p_ei; // 'eventignore'
+EXTERN char *p_ei; // 'eventignore'
EXTERN int p_et; ///< 'expandtab'
EXTERN int p_exrc; // 'exrc'
-EXTERN char_u *p_fenc; ///< 'fileencoding'
-EXTERN char_u *p_fencs; // 'fileencodings'
-EXTERN char_u *p_ff; ///< 'fileformat'
-EXTERN char *p_ffs; // 'fileformats'
+EXTERN char *p_fenc; ///< 'fileencoding'
+EXTERN char *p_fencs; // 'fileencodings'
+EXTERN char *p_ff; ///< 'fileformat'
+EXTERN char *p_ffs; // 'fileformats'
EXTERN int p_fic; // 'fileignorecase'
-EXTERN char_u *p_ft; ///< 'filetype'
-EXTERN char_u *p_fcs; ///< 'fillchar'
+EXTERN char *p_ft; ///< 'filetype'
+EXTERN char *p_fcs; ///< 'fillchar'
EXTERN int p_fixeol; ///< 'fixendofline'
-EXTERN char_u *p_fcl; // 'foldclose'
+EXTERN char *p_fcl; // 'foldclose'
EXTERN long p_fdls; // 'foldlevelstart'
-EXTERN char_u *p_fdo; // 'foldopen'
+EXTERN char *p_fdo; // 'foldopen'
EXTERN unsigned fdo_flags;
#define FDO_ALL 0x001
#define FDO_BLOCK 0x002
@@ -536,32 +536,32 @@ EXTERN unsigned fdo_flags;
EXTERN char_u *p_fex; ///< 'formatexpr'
EXTERN char_u *p_flp; ///< 'formatlistpat'
EXTERN char_u *p_fo; ///< 'formatoptions'
-EXTERN char_u *p_fp; // 'formatprg'
+EXTERN char_u *p_fp; // 'formatprg'
EXTERN int p_fs; // 'fsync'
EXTERN int p_gd; // 'gdefault'
-EXTERN char_u *p_pdev; // 'printdevice'
-EXTERN char_u *p_penc; // 'printencoding'
-EXTERN char_u *p_pexpr; // 'printexpr'
-EXTERN char_u *p_pmfn; // 'printmbfont'
-EXTERN char_u *p_pmcs; // 'printmbcharset'
-EXTERN char_u *p_pfn; // 'printfont'
-EXTERN char_u *p_popt; // 'printoptions'
-EXTERN char_u *p_header; // 'printheader'
-EXTERN char_u *p_guicursor; // 'guicursor'
-EXTERN char_u *p_guifont; // 'guifont'
-EXTERN char_u *p_guifontwide; // 'guifontwide'
-EXTERN char_u *p_hf; // 'helpfile'
+EXTERN char_u *p_pdev; // 'printdevice'
+EXTERN char *p_penc; // 'printencoding'
+EXTERN char *p_pexpr; // 'printexpr'
+EXTERN char *p_pmfn; // 'printmbfont'
+EXTERN char *p_pmcs; // 'printmbcharset'
+EXTERN char *p_pfn; // 'printfont'
+EXTERN char *p_popt; // 'printoptions'
+EXTERN char_u *p_header; // 'printheader'
+EXTERN char *p_guicursor; // 'guicursor'
+EXTERN char_u *p_guifont; // 'guifont'
+EXTERN char_u *p_guifontwide; // 'guifontwide'
+EXTERN char *p_hf; // 'helpfile'
EXTERN long p_hh; // 'helpheight'
-EXTERN char_u *p_hlg; // 'helplang'
+EXTERN char_u *p_hlg; // 'helplang'
EXTERN int p_hid; // 'hidden'
-EXTERN char_u *p_hl; // 'highlight'
+EXTERN char *p_hl; // 'highlight'
EXTERN int p_hls; // 'hlsearch'
EXTERN long p_hi; // 'history'
EXTERN int p_hkmap; // 'hkmap'
EXTERN int p_hkmapp; // 'hkmapp'
EXTERN int p_arshape; // 'arabicshape'
EXTERN int p_icon; // 'icon'
-EXTERN char_u *p_iconstring; // 'iconstring'
+EXTERN char *p_iconstring; // 'iconstring'
EXTERN int p_ic; // 'ignorecase'
EXTERN long p_iminsert; ///< 'iminsert'
EXTERN long p_imsearch; ///< 'imsearch'
@@ -570,30 +570,30 @@ EXTERN char_u *p_inex; ///< 'includeexpr'
EXTERN int p_is; // 'incsearch'
EXTERN char_u *p_inde; ///< 'indentexpr'
EXTERN char_u *p_indk; ///< 'indentkeys'
-EXTERN char_u *p_icm; // 'inccommand'
-EXTERN char_u *p_isf; // 'isfname'
-EXTERN char_u *p_isi; // 'isident'
-EXTERN char_u *p_isk; ///< 'iskeyword'
-EXTERN char_u *p_isp; // 'isprint'
+EXTERN char *p_icm; // 'inccommand'
+EXTERN char *p_isf; // 'isfname'
+EXTERN char *p_isi; // 'isident'
+EXTERN char *p_isk; ///< 'iskeyword'
+EXTERN char *p_isp; // 'isprint'
EXTERN int p_js; // 'joinspaces'
-EXTERN char_u *p_jop; // 'jumpooptions'
+EXTERN char *p_jop; // 'jumpooptions'
EXTERN unsigned jop_flags;
#define JOP_STACK 0x01
#define JOP_VIEW 0x02
EXTERN char_u *p_keymap; ///< 'keymap'
-EXTERN char_u *p_kp; // 'keywordprg'
-EXTERN char_u *p_km; // 'keymodel'
-EXTERN char_u *p_langmap; // 'langmap'
+EXTERN char_u *p_kp; // 'keywordprg'
+EXTERN char *p_km; // 'keymodel'
+EXTERN char *p_langmap; // 'langmap'
EXTERN int p_lnr; // 'langnoremap'
EXTERN int p_lrm; // 'langremap'
-EXTERN char_u *p_lm; // 'langmenu'
-EXTERN long p_lines; // 'lines'
-EXTERN long p_linespace; // 'linespace'
+EXTERN char_u *p_lm; // 'langmenu'
+EXTERN long p_lines; // 'lines'
+EXTERN long p_linespace; // 'linespace'
EXTERN int p_lisp; ///< 'lisp'
-EXTERN char_u *p_lispwords; // 'lispwords'
+EXTERN char_u *p_lispwords; // 'lispwords'
EXTERN long p_ls; // 'laststatus'
EXTERN long p_stal; // 'showtabline'
-EXTERN char_u *p_lcs; // 'listchars'
+EXTERN char *p_lcs; // 'listchars'
EXTERN int p_lz; // 'lazyredraw'
EXTERN int p_lpl; // 'loadplugins'
@@ -610,60 +610,60 @@ EXTERN long p_mfd; // 'maxfuncdepth'
EXTERN long p_mmd; // 'maxmapdepth'
EXTERN long p_mmp; // 'maxmempattern'
EXTERN long p_mis; // 'menuitems'
-EXTERN char_u *p_msm; // 'mkspellmem'
+EXTERN char *p_msm; // 'mkspellmem'
EXTERN int p_ml; ///< 'modeline'
-EXTERN int p_mle; // 'modelineexpr'
+EXTERN int p_mle; // 'modelineexpr'
EXTERN long p_mls; // 'modelines'
EXTERN int p_ma; ///< 'modifiable'
EXTERN int p_mod; ///< 'modified'
-EXTERN char_u *p_mouse; // 'mouse'
-EXTERN char_u *p_mousem; // 'mousemodel'
-EXTERN int p_mousef; // 'mousefocus'
-EXTERN char_u *p_mousescroll; // 'mousescroll'
+EXTERN char *p_mouse; // 'mouse'
+EXTERN char *p_mousem; // 'mousemodel'
+EXTERN int p_mousef; // 'mousefocus'
+EXTERN char *p_mousescroll; // 'mousescroll'
EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT);
EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT);
EXTERN long p_mouset; // 'mousetime'
EXTERN int p_more; // 'more'
EXTERN char_u *p_nf; ///< 'nrformats'
-EXTERN char_u *p_opfunc; // 'operatorfunc'
+EXTERN char *p_opfunc; // 'operatorfunc'
EXTERN char_u *p_para; // 'paragraphs'
EXTERN int p_paste; // 'paste'
EXTERN char_u *p_pt; // 'pastetoggle'
EXTERN char_u *p_pex; // 'patchexpr'
-EXTERN char_u *p_pm; // 'patchmode'
+EXTERN char *p_pm; // 'patchmode'
EXTERN char_u *p_path; // 'path'
EXTERN char_u *p_cdpath; // 'cdpath'
EXTERN int p_pi; ///< 'preserveindent'
EXTERN long p_pyx; // 'pyxversion'
EXTERN char_u *p_qe; ///< 'quoteescape'
EXTERN int p_ro; ///< 'readonly'
-EXTERN char_u *p_rdb; // 'redrawdebug'
+EXTERN char *p_rdb; // 'redrawdebug'
EXTERN unsigned rdb_flags;
#define RDB_COMPOSITOR 0x001
#define RDB_NOTHROTTLE 0x002
#define RDB_INVALID 0x004
#define RDB_NODELTA 0x008
-EXTERN long p_rdt; // 'redrawtime'
-EXTERN long p_re; // 'regexpengine'
-EXTERN long p_report; // 'report'
-EXTERN long p_pvh; // 'previewheight'
-EXTERN int p_ari; // 'allowrevins'
-EXTERN int p_ri; // 'revins'
-EXTERN int p_ru; // 'ruler'
-EXTERN char_u *p_ruf; // 'rulerformat'
-EXTERN char_u *p_pp; // 'packpath'
-EXTERN char_u *p_qftf; // 'quickfixtextfunc'
-EXTERN char_u *p_rtp; // 'runtimepath'
-EXTERN long p_scbk; // 'scrollback'
-EXTERN long p_sj; // 'scrolljump'
-EXTERN long p_so; // 'scrolloff'
-EXTERN char *p_sbo; // 'scrollopt'
-EXTERN char_u *p_sections; // 'sections'
-EXTERN int p_secure; // 'secure'
-EXTERN char_u *p_sel; // 'selection'
-EXTERN char_u *p_slm; // 'selectmode'
-EXTERN char_u *p_ssop; // 'sessionoptions'
+EXTERN long p_rdt; // 'redrawtime'
+EXTERN long p_re; // 'regexpengine'
+EXTERN long p_report; // 'report'
+EXTERN long p_pvh; // 'previewheight'
+EXTERN int p_ari; // 'allowrevins'
+EXTERN int p_ri; // 'revins'
+EXTERN int p_ru; // 'ruler'
+EXTERN char *p_ruf; // 'rulerformat'
+EXTERN char *p_pp; // 'packpath'
+EXTERN char *p_qftf; // 'quickfixtextfunc'
+EXTERN char *p_rtp; // 'runtimepath'
+EXTERN long p_scbk; // 'scrollback'
+EXTERN long p_sj; // 'scrolljump'
+EXTERN long p_so; // 'scrolloff'
+EXTERN char *p_sbo; // 'scrollopt'
+EXTERN char *p_sections; // 'sections'
+EXTERN int p_secure; // 'secure'
+EXTERN char *p_sel; // 'selection'
+EXTERN char *p_slm; // 'selectmode'
+EXTERN char *p_ssop; // 'sessionoptions'
EXTERN unsigned ssop_flags;
#define SSOP_BUFFERS 0x001
@@ -696,12 +696,12 @@ EXTERN int p_stmp; // 'shelltemp'
#ifdef BACKSLASH_IN_FILENAME
EXTERN int p_ssl; // 'shellslash'
#endif
-EXTERN char_u *p_stl; // 'statusline'
-EXTERN char *p_wbr; // 'winbar'
+EXTERN char *p_stl; // 'statusline'
+EXTERN char *p_wbr; // 'winbar'
EXTERN int p_sr; // 'shiftround'
EXTERN long p_sw; ///< 'shiftwidth'
-EXTERN char_u *p_shm; // 'shortmess'
-EXTERN char_u *p_sbr; // 'showbreak'
+EXTERN char *p_shm; // 'shortmess'
+EXTERN char *p_sbr; // 'showbreak'
EXTERN int p_sc; // 'showcmd'
EXTERN int p_sft; // 'showfulltag'
EXTERN int p_sm; // 'showmatch'
@@ -713,12 +713,12 @@ EXTERN int p_si; ///< 'smartindent'
EXTERN int p_sta; // 'smarttab'
EXTERN long p_sts; ///< 'softtabstop'
EXTERN int p_sb; // 'splitbelow'
-EXTERN char_u *p_sua; ///< 'suffixesadd'
+EXTERN char *p_sua; ///< 'suffixesadd'
EXTERN int p_swf; ///< 'swapfile'
EXTERN long p_smc; ///< 'synmaxcol'
EXTERN long p_tpm; // 'tabpagemax'
-EXTERN char_u *p_tal; // 'tabline'
-EXTERN char_u *p_tpf; // 'termpastefilter'
+EXTERN char *p_tal; // 'tabline'
+EXTERN char *p_tpf; // 'termpastefilter'
EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter'
#define TPF_BS 0x001
#define TPF_HT 0x002
@@ -731,12 +731,12 @@ EXTERN char_u *p_tfu; ///< 'tagfunc'
EXTERN char_u *p_spc; ///< 'spellcapcheck'
EXTERN char_u *p_spf; ///< 'spellfile'
EXTERN char_u *p_spl; ///< 'spelllang'
-EXTERN char_u *p_spo; // 'spelloptions'
-EXTERN char_u *p_sps; // 'spellsuggest'
+EXTERN char_u *p_spo; // 'spelloptions'
+EXTERN char *p_sps; // 'spellsuggest'
EXTERN int p_spr; // 'splitright'
EXTERN int p_sol; // 'startofline'
-EXTERN char_u *p_su; // 'suffixes'
-EXTERN char_u *p_swb; // 'switchbuf'
+EXTERN char_u *p_su; // 'suffixes'
+EXTERN char *p_swb; // 'switchbuf'
EXTERN unsigned swb_flags;
// Keep in sync with p_swb_values in optionstr.c
#define SWB_USEOPEN 0x001
@@ -748,7 +748,7 @@ EXTERN unsigned swb_flags;
EXTERN char_u *p_syn; ///< 'syntax'
EXTERN long p_ts; ///< 'tabstop'
EXTERN int p_tbs; ///< 'tagbsearch'
-EXTERN char_u *p_tc; ///< 'tagcase'
+EXTERN char *p_tc; ///< 'tagcase'
EXTERN unsigned tc_flags; ///< flags from 'tagcase'
#define TC_FOLLOWIC 0x01
#define TC_IGNORE 0x02
@@ -767,7 +767,7 @@ EXTERN long p_tm; ///< 'timeoutlen'
EXTERN int p_title; ///< 'title'
EXTERN long p_titlelen; ///< 'titlelen'
EXTERN char_u *p_titleold; ///< 'titleold'
-EXTERN char_u *p_titlestring; ///< 'titlestring'
+EXTERN char *p_titlestring; ///< 'titlestring'
EXTERN char_u *p_tsr; ///< 'thesaurus'
EXTERN int p_tgc; ///< 'termguicolors'
EXTERN int p_ttimeout; ///< 'ttimeout'
@@ -778,12 +778,12 @@ EXTERN long p_ul; ///< 'undolevels'
EXTERN long p_ur; ///< 'undoreload'
EXTERN long p_uc; ///< 'updatecount'
EXTERN long p_ut; ///< 'updatetime'
-EXTERN char_u *p_shada; ///< 'shada'
+EXTERN char *p_shada; ///< 'shada'
EXTERN char *p_shadafile; ///< 'shadafile'
EXTERN char_u *p_vsts; ///< 'varsofttabstop'
EXTERN char_u *p_vts; ///< 'vartabstop'
EXTERN char_u *p_vdir; ///< 'viewdir'
-EXTERN char_u *p_vop; ///< 'viewoptions'
+EXTERN char *p_vop; ///< 'viewoptions'
EXTERN unsigned vop_flags; ///< uses SSOP_ flags
EXTERN int p_vb; ///< 'visualbell'
EXTERN char_u *p_ve; ///< 'virtualedit'
@@ -801,18 +801,18 @@ char_u *p_vfile = (char_u *)""; // used before options are initialized
extern char_u *p_vfile; // 'verbosefile'
#endif
EXTERN int p_warn; // 'warn'
-EXTERN char_u *p_wop; // 'wildoptions'
+EXTERN char *p_wop; // 'wildoptions'
EXTERN unsigned wop_flags;
#define WOP_TAGFILE 0x01
#define WOP_PUM 0x02
EXTERN long p_window; // 'window'
-EXTERN char_u *p_wak; // 'winaltkeys'
-EXTERN char_u *p_wig; // 'wildignore'
-EXTERN char_u *p_ww; // 'whichwrap'
+EXTERN char *p_wak; // 'winaltkeys'
+EXTERN char *p_wig; // 'wildignore'
+EXTERN char *p_ww; // 'whichwrap'
EXTERN long p_wc; // 'wildchar'
EXTERN long p_wcm; // 'wildcharm'
EXTERN int p_wic; // 'wildignorecase'
-EXTERN char_u *p_wim; // 'wildmode'
+EXTERN char *p_wim; // 'wildmode'
EXTERN int p_wmnu; // 'wildmenu'
EXTERN long p_wh; // 'winheight'
EXTERN long p_wmh; // 'winminheight'
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index e4cdf883fe..808a70c8cb 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -122,21 +122,21 @@ static char_u SHM_ALL[] = { SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_L
/// option values.
void didset_string_options(void)
{
- (void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true);
- (void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, true);
- (void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, true);
- (void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true);
- (void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true);
- (void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true);
- (void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, true);
- (void)opt_strings_flags(p_rdb, p_rdb_values, &rdb_flags, true);
- (void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, false);
- (void)opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true);
+ (void)opt_strings_flags((char_u *)p_cmp, p_cmp_values, &cmp_flags, true);
+ (void)opt_strings_flags((char_u *)p_bkc, p_bkc_values, &bkc_flags, true);
+ (void)opt_strings_flags((char_u *)p_bo, p_bo_values, &bo_flags, true);
+ (void)opt_strings_flags((char_u *)p_ssop, p_ssop_values, &ssop_flags, true);
+ (void)opt_strings_flags((char_u *)p_vop, p_ssop_values, &vop_flags, true);
+ (void)opt_strings_flags((char_u *)p_fdo, p_fdo_values, &fdo_flags, true);
+ (void)opt_strings_flags((char_u *)p_dy, p_dy_values, &dy_flags, true);
+ (void)opt_strings_flags((char_u *)p_rdb, p_rdb_values, &rdb_flags, true);
+ (void)opt_strings_flags((char_u *)p_tc, p_tc_values, &tc_flags, false);
+ (void)opt_strings_flags((char_u *)p_tpf, p_tpf_values, &tpf_flags, true);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, true);
- (void)opt_strings_flags(p_swb, p_swb_values, &swb_flags, true);
- (void)opt_strings_flags(p_wop, p_wop_values, &wop_flags, true);
- (void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, true);
- (void)opt_strings_flags(p_cb, p_cb_values, &cb_flags, true);
+ (void)opt_strings_flags((char_u *)p_swb, p_swb_values, &swb_flags, true);
+ (void)opt_strings_flags((char_u *)p_wop, p_wop_values, &wop_flags, true);
+ (void)opt_strings_flags((char_u *)p_jop, p_jop_values, &jop_flags, true);
+ (void)opt_strings_flags((char_u *)p_cb, p_cb_values, &cb_flags, true);
}
/// Trigger the OptionSet autocommand.
@@ -281,19 +281,19 @@ void check_string_option(char **pp)
///
/// @param opt_idx option index
/// @param varp pointer to option variable
-static void set_string_option_global(int opt_idx, char_u **varp)
+static void set_string_option_global(int opt_idx, char **varp)
{
- char_u **p, *s;
+ char **p;
// the global value is always allocated
if (is_window_local_option(opt_idx)) {
- p = (char_u **)GLOBAL_WO(varp);
+ p = (char **)GLOBAL_WO(varp);
} else {
- p = (char_u **)get_option_var(opt_idx);
+ p = (char **)get_option_var(opt_idx);
}
if (!is_global_option(opt_idx) && p != varp) {
- s = vim_strsave(*varp);
- free_string_option((char *)(*p));
+ char *s = xstrdup(*varp);
+ free_string_option(*p);
*p = s;
}
}
@@ -339,7 +339,7 @@ void set_string_option_direct(const char *name, int opt_idx, const char *val, in
// For buffer/window local option may also set the global value.
if (both) {
- set_string_option_global(idx, (char_u **)varp);
+ set_string_option_global(idx, varp);
}
set_option_flag(idx, P_ALLOCED);
@@ -420,7 +420,7 @@ char *set_string_option(const int opt_idx, const char *const value, const int op
char *const saved_newval = xstrdup(s);
int value_checked = false;
- char *const errmsg = did_set_string_option(opt_idx, (char_u **)varp, (char_u *)oldval,
+ char *const errmsg = did_set_string_option(opt_idx, varp, oldval,
NULL, 0,
opt_flags, &value_checked);
if (errmsg == NULL) {
@@ -631,8 +631,8 @@ static int shada_idx = -1;
/// @param value_checked value was checked to be safe, no need to set P_INSECURE
///
/// @return NULL for success, or an untranslated error message for an error
-char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *errbuf,
- size_t errbuflen, int opt_flags, int *value_checked)
+char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf, size_t errbuflen,
+ int opt_flags, int *value_checked)
{
char *errmsg = NULL;
char *s, *p;
@@ -650,20 +650,19 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
&& (get_option_flags(opt_idx) & P_SECURE)) {
errmsg = e_secure;
} else if (((get_option_flags(opt_idx) & P_NFNAME)
- && strpbrk((char *)(*varp),
- (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
+ && strpbrk(*varp, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
|| ((get_option_flags(opt_idx) & P_NDNAME)
- && strpbrk((char *)(*varp), "*?[|;&<>\r\n") != NULL)) {
+ && strpbrk(*varp, "*?[|;&<>\r\n") != NULL)) {
// Check for a "normal" directory or file name in some options. Disallow a
// path separator (slash and/or backslash), wildcards and characters that
// are often illegal in a file name. Be more permissive if "secure" is off.
errmsg = e_invarg;
- } else if (gvarp == &p_bkc) { // 'backupcopy'
- char_u *bkc = p_bkc;
+ } else if (gvarp == (char_u **)&p_bkc) { // 'backupcopy'
+ char *bkc = p_bkc;
unsigned int *flags = &bkc_flags;
if (opt_flags & OPT_LOCAL) {
- bkc = (char_u *)curbuf->b_p_bkc;
+ bkc = curbuf->b_p_bkc;
flags = &curbuf->b_bkc_flags;
}
@@ -671,7 +670,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// make the local value empty: use the global value
*flags = 0;
} else {
- if (opt_strings_flags(bkc, p_bkc_values, flags, true) != OK) {
+ if (opt_strings_flags((char_u *)bkc, p_bkc_values, flags, true) != OK) {
errmsg = e_invarg;
}
@@ -679,7 +678,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
+ ((*flags & BKC_YES) != 0)
+ ((*flags & BKC_NO) != 0) != 1) {
// Must have exactly one of "auto", "yes" and "no".
- (void)opt_strings_flags(oldval, p_bkc_values, flags, true);
+ (void)opt_strings_flags((char_u *)oldval, p_bkc_values, flags, true);
errmsg = e_invarg;
}
}
@@ -688,12 +687,12 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
*p_pm == '.' ? p_pm + 1 : p_pm) == 0) {
errmsg = e_backupext_and_patchmode_are_equal;
}
- } else if (varp == (char_u **)&curwin->w_p_briopt) { // 'breakindentopt'
+ } else if (varp == &curwin->w_p_briopt) { // 'breakindentopt'
if (briopt_check(curwin) == FAIL) {
errmsg = e_invarg;
}
} else if (varp == &p_isi
- || varp == (char_u **)&(curbuf->b_p_isk)
+ || varp == &(curbuf->b_p_isk)
|| varp == &p_isp
|| varp == &p_isf) {
// 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
@@ -713,14 +712,14 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
} else if (varp == &p_rtp || varp == &p_pp) { // 'runtimepath' 'packpath'
runtime_search_path_invalidate();
- } else if (varp == (char_u **)&curwin->w_p_culopt
+ } else if (varp == &curwin->w_p_culopt
|| gvarp == (char_u **)&curwin->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
- if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK) {
+ if (**varp == NUL || fill_culopt_flags((char_u *)(*varp), curwin) != OK) {
errmsg = e_invarg;
}
- } else if (varp == (char_u **)&curwin->w_p_cc) { // 'colorcolumn'
+ } else if (varp == &curwin->w_p_cc) { // 'colorcolumn'
errmsg = check_colorcolumn(curwin);
- } else if (varp == &p_hlg) { // 'helplang'
+ } else if (varp == (char **)&p_hlg) { // 'helplang'
// Check for "", "ab", "ab,cd", etc.
for (s = (char *)p_hlg; *s != NUL; s += 3) {
if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL)) {
@@ -736,42 +735,42 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_unsupportedoption;
}
} else if (varp == &p_jop) { // 'jumpoptions'
- if (opt_strings_flags(p_jop, p_jop_values, &jop_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_jop, p_jop_values, &jop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == &p_nf) { // 'nrformats'
- if (check_opt_strings(*varp, p_nf_values, true) != OK) {
+ if (check_opt_strings((char_u *)(*varp), p_nf_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ssop) { // 'sessionoptions'
- if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
errmsg = e_invarg;
}
if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) {
// Don't allow both "sesdir" and "curdir".
- (void)opt_strings_flags(oldval, p_ssop_values, &ssop_flags, true);
+ (void)opt_strings_flags((char_u *)oldval, p_ssop_values, &ssop_flags, true);
errmsg = e_invarg;
}
} else if (varp == &p_vop) { // 'viewoptions'
- if (opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_vop, p_ssop_values, &vop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_rdb) { // 'redrawdebug'
- if (opt_strings_flags(p_rdb, p_rdb_values, &rdb_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_rdb, p_rdb_values, &rdb_flags, true) != OK) {
errmsg = e_invarg;
}
- } else if (varp == (char_u **)&p_sbo) { // 'scrollopt'
+ } else if (varp == &p_sbo) { // 'scrollopt'
if (check_opt_strings((char_u *)p_sbo, p_scbopt_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ambw || (int *)varp == &p_emoji) { // 'ambiwidth'
- if (check_opt_strings(p_ambw, p_ambw_values, false) != OK) {
+ if (check_opt_strings((char_u *)p_ambw, p_ambw_values, false) != OK) {
errmsg = e_invarg;
} else {
errmsg = check_chars_options();
}
} else if (varp == &p_bg) { // 'background'
- if (check_opt_strings(p_bg, p_bg_values, false) == OK) {
+ if (check_opt_strings((char_u *)p_bg, p_bg_values, false) == OK) {
int dark = (*p_bg == 'd');
init_highlight(false, false);
@@ -781,9 +780,9 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// value, that's not what we want here. Disable the color
// scheme and set the colors again.
do_unlet(S_LEN("g:colors_name"), true);
- free_string_option((char *)p_bg);
- p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
- check_string_option((char **)&p_bg);
+ free_string_option(p_bg);
+ p_bg = xstrdup((dark ? "dark" : "light"));
+ check_string_option(&p_bg);
init_highlight(false, false);
}
} else {
@@ -794,24 +793,24 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_invarg;
}
} else if (varp == &p_wop) { // 'wildoptions'
- if (opt_strings_flags(p_wop, p_wop_values, &wop_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_wop, p_wop_values, &wop_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_wak) { // 'winaltkeys'
if (*p_wak == NUL
- || check_opt_strings(p_wak, p_wak_values, false) != OK) {
+ || check_opt_strings((char_u *)p_wak, p_wak_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_ei) { // 'eventignore'
if (check_ei() == FAIL) {
errmsg = e_invarg;
}
- } else if (varp == &p_enc || gvarp == &p_fenc || gvarp == &p_menc) {
+ } else if (varp == &p_enc || gvarp == (char_u **)&p_fenc || gvarp == &p_menc) {
// 'encoding', 'fileencoding' and 'makeencoding'
- if (gvarp == &p_fenc) {
+ if (gvarp == (char_u **)&p_fenc) {
if (!MODIFIABLE(curbuf) && opt_flags != OPT_GLOBAL) {
errmsg = e_modifiable;
- } else if (vim_strchr((char *)(*varp), ',') != NULL) {
+ } else if (vim_strchr(*varp, ',') != NULL) {
// No comma allowed in 'fileencoding'; catches confusing it
// with 'fileencodings'.
errmsg = e_invarg;
@@ -825,9 +824,9 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (errmsg == NULL) {
// canonize the value, so that STRCMP() can be used on it
- p = (char *)enc_canonize(*varp);
+ p = (char *)enc_canonize((char_u *)(*varp));
xfree(*varp);
- *varp = (char_u *)p;
+ *varp = p;
if (varp == &p_enc) {
// only encoding=utf-8 allowed
if (STRCMP(p_enc, "utf-8") != 0) {
@@ -839,11 +838,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
} else if (varp == &p_penc) {
// Canonize printencoding if VIM standard one
- p = (char *)enc_canonize(p_penc);
+ p = (char *)enc_canonize((char_u *)p_penc);
xfree(p_penc);
- p_penc = (char_u *)p;
- } else if (varp == (char_u **)&curbuf->b_p_keymap) {
- if (!valid_filetype(*varp)) {
+ p_penc = p;
+ } else if (varp == &curbuf->b_p_keymap) {
+ if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg;
} else {
int secure_save = secure;
@@ -884,10 +883,10 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
status_redraw_curbuf();
}
- } else if (gvarp == &p_ff) { // 'fileformat'
+ } else if (gvarp == (char_u **)&p_ff) { // 'fileformat'
if (!MODIFIABLE(curbuf) && !(opt_flags & OPT_GLOBAL)) {
errmsg = e_modifiable;
- } else if (check_opt_strings(*varp, p_ff_values, false) != OK) {
+ } else if (check_opt_strings((char_u *)(*varp), p_ff_values, false) != OK) {
errmsg = e_invarg;
} else {
redraw_titles();
@@ -899,12 +898,12 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
redraw_curbuf_later(UPD_NOT_VALID);
}
}
- } else if (varp == (char_u **)&p_ffs) { // 'fileformats'
+ } else if (varp == &p_ffs) { // 'fileformats'
if (check_opt_strings((char_u *)p_ffs, p_ff_values, true) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == &p_mps) { // 'matchpairs'
- for (p = (char *)(*varp); *p != NUL; p++) {
+ for (p = *varp; *p != NUL; p++) {
int x2 = -1;
int x3 = -1;
@@ -924,8 +923,8 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
break;
}
}
- } else if (gvarp == &p_com) { // 'comments'
- for (s = (char *)(*varp); *s;) {
+ } else if (gvarp == (char_u **)&p_com) { // 'comments'
+ for (s = *varp; *s;) {
while (*s && *s != ':') {
if (vim_strchr(COM_ALL, *s) == NULL
&& !ascii_isdigit(*s) && *s != '-') {
@@ -953,7 +952,8 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
} else if (varp == &p_lcs || varp == &p_fcs) { // global 'listchars' or 'fillchars'
char **local_ptr = varp == &p_lcs ? &curwin->w_p_lcs : &curwin->w_p_fcs;
// only apply the global value to "curwin" when it does not have a local value
- errmsg = set_chars_option(curwin, varp, **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
+ errmsg =
+ set_chars_option(curwin, (char_u **)varp, **local_ptr == NUL || !(opt_flags & OPT_GLOBAL));
if (errmsg == NULL) {
// If the current window is set to use the global
// 'listchars'/'fillchars' value, clear the window-local value.
@@ -972,13 +972,13 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
redraw_all_later(UPD_NOT_VALID);
}
- } else if (varp == (char_u **)&curwin->w_p_lcs) { // local 'listchars'
- errmsg = set_chars_option(curwin, varp, true);
- } else if (varp == (char_u **)&curwin->w_p_fcs) { // local 'fillchars'
- errmsg = set_chars_option(curwin, varp, true);
+ } else if (varp == &curwin->w_p_lcs) { // local 'listchars'
+ errmsg = set_chars_option(curwin, (char_u **)varp, true);
+ } else if (varp == &curwin->w_p_fcs) { // local 'fillchars'
+ errmsg = set_chars_option(curwin, (char_u **)varp, true);
} else if (varp == &p_cedit) { // 'cedit'
errmsg = check_cedit();
- } else if (varp == &p_vfile) { // 'verbosefile'
+ } else if (varp == (char **)&p_vfile) { // 'verbosefile'
verbose_stop();
if (*p_vfile != NUL && verbose_open() == FAIL) {
errmsg = e_invarg;
@@ -993,7 +993,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// there would be a disconnect between the check for P_ALLOCED at the start
// of the function and the set of P_ALLOCED at the end of the function.
free_oldval = (get_option_flags(opt_idx) & P_ALLOCED);
- for (s = (char *)p_shada; *s;) {
+ for (s = p_shada; *s;) {
// Check it's a valid character
if (vim_strchr("!\"%'/:<@cfhnrs", *s) == NULL) {
errmsg = illegal_char(errbuf, errbuflen, *s);
@@ -1037,8 +1037,8 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (*p_shada && errmsg == NULL && get_shada_parameter('\'') < 0) {
errmsg = N_("E528: Must specify a ' value");
}
- } else if (gvarp == &p_sbr) { // 'showbreak'
- for (s = (char *)(*varp); *s;) {
+ } else if (gvarp == (char_u **)&p_sbr) { // 'showbreak'
+ for (s = *varp; *s;) {
if (ptr2cells(s) != 1) {
errmsg = e_showbreak_contains_unprintable_or_wide_character;
}
@@ -1052,14 +1052,14 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = parse_printmbfont();
} else if (varp == &p_langmap) { // 'langmap'
langmap_set();
- } else if (varp == &p_breakat) { // 'breakat'
+ } else if (varp == (char **)&p_breakat) { // 'breakat'
fill_breakat_flags();
} else if (varp == &p_titlestring || varp == &p_iconstring) {
// 'titlestring' and 'iconstring'
int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
// NULL => statusline syntax
- if (vim_strchr((char *)(*varp), '%') && check_stl_option((char *)(*varp)) == NULL) {
+ if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) {
stl_syntax |= flagval;
} else {
stl_syntax &= ~flagval;
@@ -1067,65 +1067,65 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
did_set_title();
} else if (varp == &p_sel) { // 'selection'
if (*p_sel == NUL
- || check_opt_strings(p_sel, p_sel_values, false) != OK) {
+ || check_opt_strings((char_u *)p_sel, p_sel_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_slm) { // 'selectmode'
- if (check_opt_strings(p_slm, p_slm_values, true) != OK) {
+ if (check_opt_strings((char_u *)p_slm, p_slm_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_km) { // 'keymodel'
- if (check_opt_strings(p_km, p_km_values, true) != OK) {
+ if (check_opt_strings((char_u *)p_km, p_km_values, true) != OK) {
errmsg = e_invarg;
} else {
- km_stopsel = (vim_strchr((char *)p_km, 'o') != NULL);
- km_startsel = (vim_strchr((char *)p_km, 'a') != NULL);
+ km_stopsel = (vim_strchr(p_km, 'o') != NULL);
+ km_startsel = (vim_strchr(p_km, 'a') != NULL);
}
} else if (varp == &p_mousem) { // 'mousemodel'
- if (check_opt_strings(p_mousem, p_mousem_values, false) != OK) {
+ if (check_opt_strings((char_u *)p_mousem, p_mousem_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_mousescroll) { // 'mousescroll'
- errmsg = check_mousescroll((char *)p_mousescroll);
+ errmsg = check_mousescroll(p_mousescroll);
} else if (varp == &p_swb) { // 'switchbuf'
- if (opt_strings_flags(p_swb, p_swb_values, &swb_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_swb, p_swb_values, &swb_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_debug) { // 'debug'
- if (check_opt_strings(p_debug, p_debug_values, true) != OK) {
+ if (check_opt_strings((char_u *)p_debug, p_debug_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_dy) { // 'display'
- if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_dy, p_dy_values, &dy_flags, true) != OK) {
errmsg = e_invarg;
} else {
(void)init_chartab();
msg_grid_validate();
}
} else if (varp == &p_ead) { // 'eadirection'
- if (check_opt_strings(p_ead, p_ead_values, false) != OK) {
+ if (check_opt_strings((char_u *)p_ead, p_ead_values, false) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_cb) { // 'clipboard'
- if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_cb, p_cb_values, &cb_flags, true) != OK) {
errmsg = e_invarg;
}
- } else if (varp == (char_u **)&(curwin->w_s->b_p_spl) // 'spell'
- || varp == (char_u **)&(curwin->w_s->b_p_spf)) {
+ } else if (varp == &(curwin->w_s->b_p_spl) // 'spell'
+ || varp == &(curwin->w_s->b_p_spf)) {
// When 'spelllang' or 'spellfile' is set and there is a window for this
// buffer in which 'spell' is set load the wordlists.
- const bool is_spellfile = varp == (char_u **)&(curwin->w_s->b_p_spf);
+ const bool is_spellfile = varp == &(curwin->w_s->b_p_spf);
- if ((is_spellfile && !valid_spellfile(*varp))
- || (!is_spellfile && !valid_spelllang(*varp))) {
+ if ((is_spellfile && !valid_spellfile((char_u *)(*varp)))
+ || (!is_spellfile && !valid_spelllang((char_u *)(*varp)))) {
errmsg = e_invarg;
} else {
errmsg = did_set_spell_option(is_spellfile);
}
- } else if (varp == (char_u **)&(curwin->w_s->b_p_spc)) {
+ } else if (varp == &(curwin->w_s->b_p_spc)) {
// When 'spellcapcheck' is set compile the regexp program.
errmsg = compile_cap_prog(curwin->w_s);
- } else if (varp == (char_u **)&(curwin->w_s->b_p_spo)) { // 'spelloptions'
+ } else if (varp == &(curwin->w_s->b_p_spo)) { // 'spelloptions'
if (**varp != NUL && STRCMP("camel", *varp) != 0) {
errmsg = e_invarg;
}
@@ -1156,24 +1156,25 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
redraw_titles();
}
- } else if (gvarp == &p_stl || gvarp == (char_u **)&p_wbr || varp == &p_tal || varp == &p_ruf) {
+ } else if (gvarp == (char_u **)&p_stl || gvarp == (char_u **)&p_wbr || varp == &p_tal
+ || varp == &p_ruf) {
// 'statusline', 'winbar', 'tabline' or 'rulerformat'
int wid;
if (varp == &p_ruf) { // reset ru_wid first
ru_wid = 0;
}
- s = (char *)(*varp);
+ s = *varp;
if (varp == &p_ruf && *s == '%') {
// set ru_wid if 'ruf' starts with "%99("
if (*++s == '-') { // ignore a '-'
s++;
}
wid = getdigits_int(&s, true, 0);
- if (wid && *s == '(' && (errmsg = check_stl_option((char *)p_ruf)) == NULL) {
+ if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL) {
ru_wid = wid;
} else {
- errmsg = check_stl_option((char *)p_ruf);
+ errmsg = check_stl_option(p_ruf);
}
} else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') {
// check 'statusline', 'winbar' or 'tabline' only if it doesn't start with "%!"
@@ -1188,7 +1189,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
} else if (gvarp == &p_cpt) {
// check if it is a valid value for 'complete' -- Acevedo
- for (s = (char *)(*varp); *s;) {
+ for (s = *varp; *s;) {
while (*s == ',' || *s == ' ') {
s++;
}
@@ -1222,7 +1223,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
}
} else if (varp == &p_cot) { // 'completeopt'
- if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
+ if (check_opt_strings((char_u *)p_cot, p_cot_values, true) != OK) {
errmsg = e_invarg;
} else {
completeopt_was_set();
@@ -1234,8 +1235,8 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_invarg;
}
#endif
- } else if (varp == (char_u **)&curwin->w_p_scl) { // 'signcolumn'
- if (check_signcolumn(*varp) != OK) {
+ } else if (varp == &curwin->w_p_scl) { // 'signcolumn'
+ if (check_signcolumn((char_u *)(*varp)) != OK) {
errmsg = e_invarg;
}
// When changing the 'signcolumn' to or from 'number', recompute the
@@ -1245,13 +1246,13 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
&& (curwin->w_p_nu || curwin->w_p_rnu)) {
curwin->w_nrwidth_line_count = 0;
}
- } else if (varp == (char_u **)&curwin->w_p_fdc
- || varp == (char_u **)&curwin->w_allbuf_opt.wo_fdc) {
+ } else if (varp == &curwin->w_p_fdc
+ || varp == &curwin->w_allbuf_opt.wo_fdc) {
// 'foldcolumn'
- if (**varp == NUL || check_opt_strings(*varp, p_fdc_values, false) != OK) {
+ if (**varp == NUL || check_opt_strings((char_u *)(*varp), p_fdc_values, false) != OK) {
errmsg = e_invarg;
}
- } else if (varp == &p_pt) {
+ } else if (varp == (char **)&p_pt) {
// 'pastetoggle': translate key codes like in a mapping
if (*p_pt) {
p = NULL;
@@ -1269,21 +1270,21 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (*p_bs > '3' || p_bs[1] != NUL) {
errmsg = e_invarg;
}
- } else if (check_opt_strings(p_bs, p_bs_values, true) != OK) {
+ } else if (check_opt_strings((char_u *)p_bs, p_bs_values, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_bo) {
- if (opt_strings_flags(p_bo, p_bo_values, &bo_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_bo, p_bo_values, &bo_flags, true) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == &p_tc) { // 'tagcase'
+ } else if (gvarp == (char_u **)&p_tc) { // 'tagcase'
unsigned int *flags;
if (opt_flags & OPT_LOCAL) {
p = curbuf->b_p_tc;
flags = &curbuf->b_tc_flags;
} else {
- p = (char *)p_tc;
+ p = p_tc;
flags = &tc_flags;
}
@@ -1295,7 +1296,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_invarg;
}
} else if (varp == &p_cmp) { // 'casemap'
- if (opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_cmp, p_cmp_values, &cmp_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_dip) { // 'diffopt'
@@ -1303,7 +1304,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_invarg;
}
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdm) { // 'foldmethod'
- if (check_opt_strings(*varp, p_fdm_values, false) != OK
+ if (check_opt_strings((char_u *)(*varp), p_fdm_values, false) != OK
|| *curwin->w_p_fdm == NUL) {
errmsg = e_invarg;
} else {
@@ -1312,29 +1313,29 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
newFoldLevel();
}
}
- } else if (varp == (char_u **)&curwin->w_p_fde) { // 'foldexpr'
+ } else if (varp == &curwin->w_p_fde) { // 'foldexpr'
if (foldmethodIsExpr(curwin)) {
foldUpdateAll(curwin);
}
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker'
- p = vim_strchr((char *)(*varp), ',');
+ p = vim_strchr(*varp, ',');
if (p == NULL) {
errmsg = N_("E536: comma required");
- } else if ((char_u *)p == *varp || p[1] == NUL) {
+ } else if (p == *varp || p[1] == NUL) {
errmsg = e_invarg;
} else if (foldmethodIsMarker(curwin)) {
foldUpdateAll(curwin);
}
} else if (gvarp == &p_cms) { // 'commentstring'
- if (**varp != NUL && strstr((char *)(*varp), "%s") == NULL) {
+ if (**varp != NUL && strstr(*varp, "%s") == NULL) {
errmsg = N_("E537: 'commentstring' must be empty or contain %s");
}
} else if (varp == &p_fdo) { // 'foldopen'
- if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_fdo, p_fdo_values, &fdo_flags, true) != OK) {
errmsg = e_invarg;
}
} else if (varp == &p_fcl) { // 'foldclose'
- if (check_opt_strings(p_fcl, p_fcl_values, true) != OK) {
+ if (check_opt_strings((char_u *)p_fcl, p_fcl_values, true) != OK) {
errmsg = e_invarg;
}
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdi) { // 'foldignore'
@@ -1365,7 +1366,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
} else if (varp == &p_csqf) {
if (p_csqf != NULL) {
- p = (char *)p_csqf;
+ p = p_csqf;
while (*p != NUL) {
if (vim_strchr(CSQF_CMDS, *p) == NULL
|| p[1] == NUL
@@ -1380,15 +1381,15 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
}
}
- } else if (gvarp == &p_cino) { // 'cinoptions'
+ } else if (gvarp == (char_u **)&p_cino) { // 'cinoptions'
// TODO(vim): recognize errors
parse_cino(curbuf);
} else if (varp == &p_icm) { // 'inccommand'
- if (check_opt_strings(p_icm, p_icm_values, false) != OK) {
+ if (check_opt_strings((char_u *)p_icm, p_icm_values, false) != OK) {
errmsg = e_invarg;
}
- } else if (gvarp == &p_ft) {
- if (!valid_filetype(*varp)) {
+ } else if (gvarp == (char_u **)&p_ft) {
+ if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg;
} else {
value_changed = STRCMP(oldval, *varp) != 0;
@@ -1398,7 +1399,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
*value_checked = true;
}
} else if (gvarp == &p_syn) {
- if (!valid_filetype(*varp)) {
+ if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg;
} else {
value_changed = STRCMP(oldval, *varp) != 0;
@@ -1407,25 +1408,25 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// even when the value comes from a modeline.
*value_checked = true;
}
- } else if (varp == (char_u **)&curwin->w_p_winhl) {
+ } else if (varp == &curwin->w_p_winhl) {
if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg;
}
} else if (varp == &p_tpf) {
- if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
+ if (opt_strings_flags((char_u *)p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
errmsg = e_invarg;
}
- } else if (varp == (char_u **)&(curbuf->b_p_vsts)) { // 'varsofttabstop'
+ } else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vsts_array);
} else {
- for (cp = *varp; *cp; cp++) {
+ for (cp = (char_u *)(*varp); *cp; cp++) {
if (ascii_isdigit(*cp)) {
continue;
}
- if (*cp == ',' && cp > *varp && *(cp - 1) != ',') {
+ if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
continue;
}
errmsg = e_invarg;
@@ -1433,24 +1434,24 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vsts_array;
- if (tabstop_set(*varp, &(curbuf->b_p_vsts_array))) {
+ if (tabstop_set((char_u *)(*varp), &(curbuf->b_p_vsts_array))) {
xfree(oldarray);
} else {
errmsg = e_invarg;
}
}
}
- } else if (varp == (char_u **)&(curbuf->b_p_vts)) { // 'vartabstop'
+ } else if (varp == &(curbuf->b_p_vts)) { // 'vartabstop'
char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vts_array);
} else {
- for (cp = *varp; *cp; cp++) {
+ for (cp = (char_u *)(*varp); *cp; cp++) {
if (ascii_isdigit(*cp)) {
continue;
}
- if (*cp == ',' && cp > *varp && *(cp - 1) != ',') {
+ if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
continue;
}
errmsg = e_invarg;
@@ -1458,7 +1459,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vts_array;
- if (tabstop_set(*varp, &(curbuf->b_p_vts_array))) {
+ if (tabstop_set((char_u *)(*varp), &(curbuf->b_p_vts_array))) {
xfree(oldarray);
if (foldmethodIsIndent(curwin)) {
foldUpdateAll(curwin);
@@ -1484,17 +1485,17 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
}
if (varp == &p_shm) { // 'shortmess'
p = (char *)SHM_ALL;
- } else if (varp == (char_u **)&(p_cpo)) { // 'cpoptions'
+ } else if (varp == &(p_cpo)) { // 'cpoptions'
p = CPO_VI;
- } else if (varp == (char_u **)&(curbuf->b_p_fo)) { // 'formatoptions'
+ } else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
p = FO_ALL;
- } else if (varp == (char_u **)&curwin->w_p_cocu) { // 'concealcursor'
+ } else if (varp == &curwin->w_p_cocu) { // 'concealcursor'
p = COCU_ALL;
} else if (varp == &p_mouse) { // 'mouse'
p = MOUSE_ALL;
}
if (p != NULL) {
- for (s = (char *)(*varp); *s; s++) {
+ for (s = *varp; *s; s++) {
if (vim_strchr(p, *s) == NULL) {
errmsg = illegal_char(errbuf, errbuflen, *s);
break;
@@ -1505,7 +1506,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// If error detected, restore the previous value.
if (errmsg != NULL) {
- free_string_option((char *)(*varp));
+ free_string_option(*varp);
*varp = oldval;
// When resetting some values, need to act on it.
if (did_chartab) {
@@ -1518,7 +1519,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// Use "free_oldval", because recursiveness may change the flags under
// our fingers (esp. init_highlight()).
if (free_oldval) {
- free_string_option((char *)oldval);
+ free_string_option(oldval);
}
set_option_flag(opt_idx, P_ALLOCED);
@@ -1536,7 +1537,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// Trigger the autocommand only after setting the flags.
// When 'syntax' is set, load the syntax of that name
- if (varp == (char_u **)&(curbuf->b_p_syn)) {
+ if (varp == &(curbuf->b_p_syn)) {
static int syn_recursive = 0;
syn_recursive++;
@@ -1546,7 +1547,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
value_changed || syn_recursive == 1, curbuf);
curbuf->b_flags |= BF_SYN_SET;
syn_recursive--;
- } else if (varp == (char_u **)&(curbuf->b_p_ft)) {
+ } else if (varp == &(curbuf->b_p_ft)) {
// 'filetype' is set, trigger the FileType autocommand
// Skip this when called from a modeline and the filetype was
// already set to this value.
@@ -1566,13 +1567,13 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
value_changed || ft_recursive == 1, curbuf);
ft_recursive--;
// Just in case the old "curbuf" is now invalid
- if (varp != (char_u **)&(curbuf->b_p_ft)) {
+ if (varp != &(curbuf->b_p_ft)) {
varp = NULL;
}
secure = secure_save;
}
}
- if (varp == (char_u **)&(curwin->w_s->b_p_spl)) {
+ if (varp == &(curwin->w_s->b_p_spl)) {
char_u fname[200];
char_u *q = (char_u *)curwin->w_s->b_p_spl;
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 795bff66cb..d46d51882e 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -937,8 +937,8 @@ char *vim_getenv(const char *name)
// - the directory name from 'helpfile' (unless it contains '$')
// - the executable name from argv[0]
if (vim_path == NULL) {
- if (p_hf != NULL && vim_strchr((char *)p_hf, '$') == NULL) {
- vim_path = (char *)p_hf;
+ if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL) {
+ vim_path = p_hf;
}
char exe_name[MAXPATHL];
@@ -957,7 +957,7 @@ char *vim_getenv(const char *name)
char *vim_path_end = path_tail(vim_path);
// remove "doc/" from 'helpfile', if present
- if (vim_path == (char *)p_hf) {
+ if (vim_path == p_hf) {
vim_path_end = remove_tail(vim_path, vim_path_end, "doc");
}
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 8d3c556c7d..d786ccbf73 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -2195,7 +2195,7 @@ int expand_wildcards(int num_pat, char **pat, int *num_files, char ***files, int
ffname = (char_u *)FullName_save((*files)[i], false);
assert((*files)[i] != NULL);
assert(ffname != NULL);
- if (match_file_list(p_wig, (char_u *)(*files)[i], ffname)) {
+ if (match_file_list((char_u *)p_wig, (char_u *)(*files)[i], ffname)) {
// remove this matching file from the list
xfree((*files)[i]);
for (j = i; j + 1 < *num_files; j++) {
diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c
index 1f36e25433..529e351f33 100644
--- a/src/nvim/popupmenu.c
+++ b/src/nvim/popupmenu.c
@@ -703,7 +703,7 @@ static bool pum_set_selected(int n, int repeat)
if ((pum_array[pum_selected].pum_info != NULL)
&& (Rows > 10)
&& (repeat <= 1)
- && (vim_strchr((char *)p_cot, 'p') != NULL)) {
+ && (vim_strchr(p_cot, 'p') != NULL)) {
win_T *curwin_save = curwin;
tabpage_T *curtab_save = curtab;
int res = OK;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 7c914b0276..f528bc651b 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -1000,7 +1000,7 @@ static int qf_setup_state(qfstate_T *pstate, char *restrict enc, const char *res
{
pstate->vc.vc_type = CONV_NONE;
if (enc != NULL && *enc != NUL) {
- convert_setup(&pstate->vc, (char_u *)enc, p_enc);
+ convert_setup(&pstate->vc, (char_u *)enc, (char_u *)p_enc);
}
if (efile != NULL
@@ -2534,7 +2534,7 @@ static int qf_open_new_file_win(qf_info_T *ll_ref)
if (win_split(0, flags) == FAIL) {
return FAIL; // not enough room for window
}
- p_swb = (char_u *)empty_option; // don't split again
+ p_swb = empty_option; // don't split again
swb_flags = 0;
RESET_BINDING(curwin);
if (ll_ref != NULL) {
@@ -2923,7 +2923,7 @@ void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit)
// If 'newwin' is true, then open the file in a new window.
static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, bool newwin)
{
- char *old_swb = (char *)p_swb;
+ char *old_swb = p_swb;
unsigned old_swb_flags = swb_flags;
const bool old_KeyTyped = KeyTyped; // getting file may reset it
@@ -2994,10 +2994,10 @@ theend:
qfl->qf_ptr = qf_ptr;
qfl->qf_index = qf_index;
}
- if (p_swb != (char_u *)old_swb && p_swb == (char_u *)empty_option) {
+ if (p_swb != old_swb && p_swb == empty_option) {
// Restore old 'switchbuf' value, but not when an autocommand or
// modeline has changed the value.
- p_swb = (char_u *)old_swb;
+ p_swb = old_swb;
swb_flags = old_swb_flags;
}
decr_quickfix_busy();
@@ -3834,7 +3834,7 @@ static buf_T *qf_find_buf(qf_info_T *qi)
/// @return OK or FAIL
int qf_process_qftf_option(void)
{
- return option_set_callback_func(p_qftf, &qftf_cb);
+ return option_set_callback_func((char_u *)p_qftf, &qftf_cb);
}
/// Update the w:quickfix_title variable in the quickfix/location list window in
@@ -7033,7 +7033,7 @@ static void hgr_search_in_rtp(qf_list_T *qfl, regmatch_T *p_regmatch, const char
FUNC_ATTR_NONNULL_ARG(1, 2)
{
// Go through all directories in 'runtimepath'
- char *p = (char *)p_rtp;
+ char *p = p_rtp;
while (*p != NUL && !got_int) {
copy_option_part(&p, (char *)NameBuff, MAXPATHL, ",");
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index a04ae271e1..23606fdc77 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -303,7 +303,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
xfree(buf);
xfree(rtp_copy);
if (!did_one && name != NULL) {
- char *basepath = path == p_rtp ? "runtimepath" : "packpath";
+ char *basepath = path == (char_u *)p_rtp ? "runtimepath" : "packpath";
if (flags & DIP_ERR) {
semsg(_(e_dirnotf), basepath, name);
@@ -550,7 +550,7 @@ int do_in_path_and_pp(char_u *path, char_u *name, int flags, DoInRuntimepathCB c
char *suffix = (flags & DIP_AFTER) ? "after/" : "";
vim_snprintf(s, len, start_dir, suffix, name);
- done |= do_in_path(p_pp, s, flags & ~DIP_AFTER, callback, cookie);
+ done |= do_in_path((char_u *)p_pp, s, flags & ~DIP_AFTER, callback, cookie);
xfree(s);
@@ -560,7 +560,7 @@ int do_in_path_and_pp(char_u *path, char_u *name, int flags, DoInRuntimepathCB c
s = xmallocz(len);
vim_snprintf(s, len, start_dir, suffix, name);
- done |= do_in_path(p_pp, s, flags & ~DIP_AFTER, callback, cookie);
+ done |= do_in_path((char_u *)p_pp, s, flags & ~DIP_AFTER, callback, cookie);
xfree(s);
}
@@ -572,7 +572,7 @@ int do_in_path_and_pp(char_u *path, char_u *name, int flags, DoInRuntimepathCB c
char *s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name);
- done |= do_in_path(p_pp, s, flags, callback, cookie);
+ done |= do_in_path((char_u *)p_pp, s, flags, callback, cookie);
xfree(s);
@@ -582,7 +582,7 @@ int do_in_path_and_pp(char_u *path, char_u *name, int flags, DoInRuntimepathCB c
s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name);
- done |= do_in_path(p_pp, s, flags, callback, cookie);
+ done |= do_in_path((char_u *)p_pp, s, flags, callback, cookie);
xfree(s);
}
@@ -665,7 +665,7 @@ RuntimeSearchPath runtime_search_path_build(void)
CharVec after_path = KV_INITIAL_VALUE;
static char_u buf[MAXPATHL];
- for (char *entry = (char *)p_pp; *entry != NUL;) {
+ for (char *entry = p_pp; *entry != NUL;) {
char *cur_entry = entry;
copy_option_part(&entry, (char *)buf, MAXPATHL, ",");
@@ -676,7 +676,7 @@ RuntimeSearchPath runtime_search_path_build(void)
}
char *rtp_entry;
- for (rtp_entry = (char *)p_rtp; *rtp_entry != NUL;) {
+ for (rtp_entry = p_rtp; *rtp_entry != NUL;) {
char *cur_entry = rtp_entry;
copy_option_part(&rtp_entry, (char *)buf, MAXPATHL, ",");
size_t buflen = STRLEN(buf);
@@ -773,7 +773,7 @@ int do_in_runtimepath(char *name, int flags, DoInRuntimepathCB callback, void *c
// TODO(bfredl): we could integrate disabled OPT dirs into the cached path
// which would effectivize ":packadd myoptpack" as well
if ((flags & (DIP_START|DIP_OPT)) && (success == FAIL || (flags & DIP_ALL))) {
- success |= do_in_path_and_pp(p_rtp, (char_u *)name, flags, callback, cookie);
+ success |= do_in_path_and_pp((char_u *)p_rtp, (char_u *)name, flags, callback, cookie);
}
return success;
}
@@ -1036,7 +1036,7 @@ static void add_opt_pack_plugin(char *fname, void *cookie)
/// Add all packages in the "start" directory to 'runtimepath'.
void add_pack_start_dirs(void)
{
- do_in_path(p_pp, NULL, DIP_ALL + DIP_DIR, add_pack_start_dir, NULL);
+ do_in_path((char_u *)p_pp, NULL, DIP_ALL + DIP_DIR, add_pack_start_dir, NULL);
}
static bool pack_has_entries(char_u *buf)
@@ -1070,9 +1070,9 @@ static void add_pack_start_dir(char *fname, void *cookie)
void load_start_packages(void)
{
did_source_packages = true;
- do_in_path(p_pp, "pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
+ do_in_path((char_u *)p_pp, "pack/*/start/*", DIP_ALL + DIP_DIR, // NOLINT
add_start_pack_plugin, &APP_LOAD);
- do_in_path(p_pp, "start/*", DIP_ALL + DIP_DIR, // NOLINT
+ do_in_path((char_u *)p_pp, "start/*", DIP_ALL + DIP_DIR, // NOLINT
add_start_pack_plugin, &APP_LOAD);
}
@@ -1093,12 +1093,12 @@ void ex_packloadall(exarg_T *eap)
void load_plugins(void)
{
if (p_lpl) {
- char_u *rtp_copy = p_rtp;
+ char_u *rtp_copy = (char_u *)p_rtp;
char_u *const plugin_pattern_vim = (char_u *)"plugin/**/*.vim"; // NOLINT
char_u *const plugin_pattern_lua = (char_u *)"plugin/**/*.lua"; // NOLINT
if (!did_source_packages) {
- rtp_copy = vim_strsave(p_rtp);
+ rtp_copy = vim_strsave((char_u *)p_rtp);
add_pack_start_dirs();
}
@@ -1139,9 +1139,10 @@ void ex_packadd(exarg_T *eap)
vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg);
// The first round don't give a "not found" error, in the second round
// only when nothing was found in the first round.
- res = do_in_path(p_pp, pat, DIP_ALL + DIP_DIR + (round == 2 && res == FAIL ? DIP_ERR : 0),
- round == 1 ? add_start_pack_plugin : add_opt_pack_plugin,
- eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
+ res =
+ do_in_path((char_u *)p_pp, pat, DIP_ALL + DIP_DIR + (round == 2 && res == FAIL ? DIP_ERR : 0),
+ round == 1 ? add_start_pack_plugin : add_opt_pack_plugin,
+ eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
xfree(pat);
}
}
@@ -1169,10 +1170,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 7;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "%s/%s*.vim", dirnames[i], pat);
- globpath((char *)p_rtp, s, &ga, 0);
+ globpath(p_rtp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "%s/%s*.lua", dirnames[i], pat);
- globpath((char *)p_rtp, s, &ga, 0);
+ globpath(p_rtp, s, &ga, 0);
}
xfree(s);
}
@@ -1182,10 +1183,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1194,10 +1195,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1208,10 +1209,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1220,10 +1221,10 @@ int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirna
size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size);
snprintf((char *)s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
if (flags & DIP_LUA) {
snprintf((char *)s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
}
xfree(s);
}
@@ -1276,9 +1277,9 @@ int ExpandPackAddDir(char_u *pat, int *num_file, char ***file)
size_t buflen = pat_len + 26;
char_u *s = xmalloc(buflen);
snprintf((char *)s, buflen, "pack/*/opt/%s*", pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
snprintf((char *)s, buflen, "opt/%s*", pat); // NOLINT
- globpath((char *)p_pp, s, &ga, 0);
+ globpath(p_pp, s, &ga, 0);
xfree(s);
for (int i = 0; i < ga.ga_len; i++) {
@@ -2017,7 +2018,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
&& firstline[1] == 0xbb && firstline[2] == 0xbf) {
// Found BOM; setup conversion, skip over BOM and recode the line.
- convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
+ convert_setup(&cookie.conv, (char_u *)"utf-8", (char_u *)p_enc);
p = (char *)string_convert(&cookie.conv, (char_u *)firstline + 3, NULL);
if (p == NULL) {
p = xstrdup((char *)firstline + 3);
@@ -2438,7 +2439,7 @@ void ex_scriptencoding(exarg_T *eap)
// Setup for conversion from the specified encoding to 'encoding'.
sp = (struct source_cookie *)getline_cookie(eap->getline, eap->cookie);
- convert_setup(&sp->conv, (char_u *)name, p_enc);
+ convert_setup(&sp->conv, (char_u *)name, (char_u *)p_enc);
if (name != eap->arg) {
xfree(name);
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 43c85bedb5..9c1064d608 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1301,7 +1301,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
const char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
int multispace_len = 0; // Length of lcs-multispace string
int lead_multispace_len = 0; // Length of lcs-leadmultispace string
- const bool is_listchars = (varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs);
+ const bool is_listchars = (varp == (char_u **)&p_lcs || varp == (char_u **)&wp->w_p_lcs);
struct chars_tab {
int *cp; ///< char value
@@ -1349,13 +1349,13 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
tab = lcs_tab;
entries = ARRAY_SIZE(lcs_tab);
if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
- value = p_lcs; // local value is empty, use the global value
+ value = (char_u *)p_lcs; // local value is empty, use the global value
}
} else {
tab = fcs_tab;
entries = ARRAY_SIZE(fcs_tab);
if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
- value = p_fcs; // local value is empty, use the global value
+ value = (char_u *)p_fcs; // local value is empty, use the global value
}
}
@@ -1520,10 +1520,10 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
/// @return an untranslated error message if any of them is invalid, NULL otherwise.
char *check_chars_options(void)
{
- if (set_chars_option(curwin, &p_lcs, false) != NULL) {
+ if (set_chars_option(curwin, (char_u **)&p_lcs, false) != NULL) {
return e_conflicts_with_value_of_listchars;
}
- if (set_chars_option(curwin, &p_fcs, false) != NULL) {
+ if (set_chars_option(curwin, (char_u **)&p_fcs, false) != NULL) {
return e_conflicts_with_value_of_fillchars;
}
FOR_ALL_TAB_WINDOWS(tp, wp) {
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 3b6bcbeeb3..190ad72a8f 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -2683,7 +2683,7 @@ int startPS(linenr_T lnum, int para, int both)
if (*s == para || *s == '\f' || (both && *s == '}')) {
return true;
}
- if (*s == '.' && (inmacro(p_sections, s + 1)
+ if (*s == '.' && (inmacro((char_u *)p_sections, s + 1)
|| (!para && inmacro(p_para, s + 1)))) {
return true;
}
@@ -5363,7 +5363,7 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
goto fpip_end;
}
}
- inc_opt = (*curbuf->b_p_inc == NUL) ? p_inc : (char_u *)curbuf->b_p_inc;
+ inc_opt = (*curbuf->b_p_inc == NUL) ? (char_u *)p_inc : (char_u *)curbuf->b_p_inc;
if (*inc_opt != NUL) {
incl_regmatch.regprog = vim_regcomp((char *)inc_opt, p_magic ? RE_MAGIC : 0);
if (incl_regmatch.regprog == NULL) {
@@ -5373,7 +5373,7 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
}
if (type == FIND_DEFINE && (*curbuf->b_p_def != NUL || *p_def != NUL)) {
def_regmatch.regprog = vim_regcomp(*curbuf->b_p_def == NUL
- ? (char *)p_def : curbuf->b_p_def,
+ ? p_def : curbuf->b_p_def,
p_magic ? RE_MAGIC : 0);
if (def_regmatch.regprog == NULL) {
goto fpip_end;
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index daa8e99d31..3de16b3e69 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -3996,7 +3996,7 @@ static bool shada_removable(const char *name)
bool retval = false;
char *new_name = home_replace_save(NULL, (char *)name);
- for (p = (char *)p_shada; *p;) {
+ for (p = p_shada; *p;) {
(void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
if (part[0] == 'r') {
home_replace(NULL, part + 1, (char *)NameBuff, MAXPATHL, true);
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 439fcff8a0..8fcb379bcf 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1518,7 +1518,7 @@ static void spell_load_lang(char_u *lang)
char_u *spell_enc(void)
{
if (STRLEN(p_enc) < 60 && STRCMP(p_enc, "iso-8859-15") != 0) {
- return p_enc;
+ return (char_u *)p_enc;
}
return (char_u *)"latin1";
}
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 46249470d1..c68dbd8e53 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -1863,7 +1863,7 @@ static long compress_added = 500000; // word count
// Sets "sps_flags".
int spell_check_msm(void)
{
- char *p = (char *)p_msm;
+ char *p = p_msm;
long start = 0;
long incr = 0;
long added = 0;
@@ -2123,8 +2123,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Setup for conversion from "ENC" to 'encoding'.
aff->af_enc = enc_canonize(items[1]);
if (!spin->si_ascii
- && convert_setup(&spin->si_conv, aff->af_enc,
- p_enc) == FAIL) {
+ && convert_setup(&spin->si_conv, aff->af_enc, (char_u *)p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
fname, aff->af_enc, p_enc);
}
@@ -3731,8 +3730,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
line += 9;
enc = enc_canonize(line);
if (!spin->si_ascii
- && convert_setup(&spin->si_conv, enc,
- p_enc) == FAIL) {
+ && convert_setup(&spin->si_conv, enc, (char_u *)p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
fname, line, p_enc);
}
@@ -5697,7 +5695,7 @@ static void init_spellfile(void)
// Loop over all entries in 'runtimepath'. Use the first one where we
// are allowed to write.
- rtp = p_rtp;
+ rtp = (char_u *)p_rtp;
while (*rtp != NUL) {
if (aspath) {
// Use directory of an entry with path, e.g., for
diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c
index ffce859ee8..fa46d94342 100644
--- a/src/nvim/spellsuggest.c
+++ b/src/nvim/spellsuggest.c
@@ -360,7 +360,7 @@ int spell_check_sps(void)
sps_flags = 0;
sps_limit = 9999;
- for (p = (char *)p_sps; *p != NUL;) {
+ for (p = p_sps; *p != NUL;) {
copy_option_part(&p, (char *)buf, MAXPATHL, ",");
f = 0;
@@ -758,7 +758,7 @@ static void spell_find_suggest(char_u *badptr, int badlen, suginfo_T *su, int ma
}
// Make a copy of 'spellsuggest', because the expression may change it.
- sps_copy = vim_strsave(p_sps);
+ sps_copy = vim_strsave((char_u *)p_sps);
// Loop over the items in 'spellsuggest'.
for (p = (char *)sps_copy; *p != NUL;) {
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index d7277b38ae..8b56eaadf0 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -448,7 +448,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
// setup environment for the task at hand
if (wp == NULL) {
// Use 'tabline'. Always at the first line of the screen.
- stl = p_tal;
+ stl = (char_u *)p_tal;
row = 0;
fillchar = ' ';
attr = HL_ATTR(HLF_TPF);
@@ -491,7 +491,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
}
if (draw_ruler) {
- stl = p_ruf;
+ stl = (char_u *)p_ruf;
// advance past any leading group spec - implicit in ru_col
if (*stl == '%') {
if (*++stl == '-') {
@@ -503,7 +503,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
}
}
if (*stl++ != '(') {
- stl = p_ruf;
+ stl = (char_u *)p_ruf;
}
}
col = ru_col - (Columns - maxwidth);
@@ -524,7 +524,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
if (*wp->w_p_stl != NUL) {
stl = (char_u *)wp->w_p_stl;
} else {
- stl = p_stl;
+ stl = (char_u *)p_stl;
}
use_sandbox = was_set_insecurely(wp, "statusline", *wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e9383e1bb3..fe37a79a5b 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -4035,17 +4035,13 @@ static void add_keyword(char_u *const name, const int id, const int flags,
///
/// @return a pointer to the first argument.
/// Return NULL if the end of the command was found instead of further args.
-static char_u *get_group_name(char_u *arg, char_u **name_end)
+static char *get_group_name(char *arg, char **name_end)
{
- char_u *rest;
+ *name_end = (char *)skiptowhite((char_u *)arg);
+ char *rest = skipwhite(*name_end);
- *name_end = skiptowhite(arg);
- rest = (char_u *)skipwhite((char *)(*name_end));
-
- /*
- * Check if there are enough arguments. The first argument may be a
- * pattern, where '|' is allowed, so only check for NUL.
- */
+ // Check if there are enough arguments. The first argument may be a
+ // pattern, where '|' is allowed, so only check for NUL.
if (ends_excmd(*arg) || *rest == NUL) {
return NULL;
}
@@ -4063,7 +4059,7 @@ static char_u *get_group_name(char_u *arg, char_u **name_end)
///
/// @return a pointer to the next argument (which isn't an option).
/// Return NULL for any error;
-static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
+static char_u *get_syn_options(char *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
{
char_u *gname_start, *gname;
int syn_id;
@@ -4117,7 +4113,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
p = flagtab[fidx].name;
int i;
for (i = 0, len = 0; p[i] != NUL; i += 2, len++) {
- if (arg[len] != (char_u)p[i] && arg[len] != (char_u)p[i + 1]) {
+ if (arg[len] != p[i] && arg[len] != p[i + 1]) {
break;
}
}
@@ -4157,16 +4153,16 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
} else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
// cchar=?
- *conceal_char = utf_ptr2char((char *)arg + 6);
- arg += utfc_ptr2len((char *)arg + 6) - 1;
+ *conceal_char = utf_ptr2char(arg + 6);
+ arg += utfc_ptr2len(arg + 6) - 1;
if (!vim_isprintc_strict(*conceal_char)) {
emsg(_("E844: invalid cchar value"));
return NULL;
}
- arg = (char_u *)skipwhite((char *)arg + 7);
+ arg = skipwhite(arg + 7);
} else {
opt->flags |= flagtab[fidx].flags;
- arg = (char_u *)skipwhite((char *)arg + len);
+ arg = skipwhite(arg + len);
if (flagtab[fidx].flags == HL_SYNC_HERE
|| flagtab[fidx].flags == HL_SYNC_THERE) {
@@ -4174,12 +4170,12 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
emsg(_("E393: group[t]here not accepted here"));
return NULL;
}
- gname_start = arg;
- arg = skiptowhite(arg);
- if (gname_start == arg) {
+ gname_start = (char_u *)arg;
+ arg = (char *)skiptowhite((char_u *)arg);
+ if (gname_start == (char_u *)arg) {
return NULL;
}
- gname = vim_strnsave(gname_start, (size_t)(arg - gname_start));
+ gname = vim_strnsave(gname_start, (size_t)((char_u *)arg - gname_start));
if (STRCMP(gname, "NONE") == 0) {
*opt->sync_idx = NONE_IDX;
} else {
@@ -4200,7 +4196,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
xfree(gname);
- arg = (char_u *)skipwhite((char *)arg);
+ arg = skipwhite(arg);
} else if (flagtab[fidx].flags == HL_FOLD
&& foldmethodIsSyntax(curwin)) {
// Need to update folds later.
@@ -4209,7 +4205,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
}
- return arg;
+ return (char_u *)arg;
}
/*
@@ -4240,16 +4236,16 @@ static void syn_incl_toplevel(int id, int *flagsp)
*/
static void syn_cmd_include(exarg_T *eap, int syncing)
{
- char_u *arg = (char_u *)eap->arg;
+ char *arg = eap->arg;
int sgl_id = 1;
- char_u *group_name_end;
- char_u *rest;
+ char *group_name_end;
+ char *rest;
char *errormsg = NULL;
int prev_toplvl_grp;
int prev_syn_inc_tag;
bool source = false;
- eap->nextcmd = (char *)find_nextcmd(arg);
+ eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
if (eap->skip) {
return;
}
@@ -4261,12 +4257,12 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
emsg(_("E397: Filename required"));
return;
}
- sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
+ sgl_id = syn_check_cluster((char_u *)arg, (int)(group_name_end - arg));
if (sgl_id == 0) {
return;
}
// separate_nextcmd() and expand_filename() depend on this
- eap->arg = (char *)rest;
+ eap->arg = rest;
}
/*
@@ -4314,13 +4310,13 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
*/
static void syn_cmd_keyword(exarg_T *eap, int syncing)
{
- char_u *arg = (char_u *)eap->arg;
- char_u *group_name_end;
+ char *arg = eap->arg;
+ char *group_name_end;
int syn_id;
- char_u *rest;
- char_u *keyword_copy = NULL;
- char_u *p;
- char_u *kw;
+ char *rest;
+ char *keyword_copy = NULL;
+ char *p;
+ char *kw;
syn_opt_arg_T syn_opt_arg;
int cnt;
int conceal_char = NUL;
@@ -4331,7 +4327,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
if (eap->skip) {
syn_id = -1;
} else {
- syn_id = syn_check_group((char *)arg, (size_t)(group_name_end - arg));
+ syn_id = syn_check_group(arg, (size_t)(group_name_end - arg));
}
if (syn_id != 0) {
// Allocate a buffer, for removing backslashes in the keyword.
@@ -4350,8 +4346,8 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
// 1: collect the options and copy the keywords to keyword_copy.
cnt = 0;
p = keyword_copy;
- for (; rest != NULL && !ends_excmd(*rest); rest = (char_u *)skipwhite((char *)rest)) {
- rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
+ rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest)) {
break;
}
@@ -4372,11 +4368,11 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
// 2: Add an entry for each keyword.
for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) {
- for (p = (char_u *)vim_strchr((char *)kw, '[');;) {
+ for (p = vim_strchr(kw, '[');;) {
if (p != NULL) {
*p = NUL;
}
- add_keyword(kw, syn_id, syn_opt_arg.flags,
+ add_keyword((char_u *)kw, syn_id, syn_opt_arg.flags,
syn_opt_arg.cont_in_list,
syn_opt_arg.next_list, conceal_char);
if (p == NULL) {
@@ -4395,7 +4391,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
kw = p + 1;
break; // skip over the "]"
}
- const int l = utfc_ptr2len((char *)p + 1);
+ const int l = utfc_ptr2len(p + 1);
memmove(p, p + 1, (size_t)l);
p += l;
@@ -4411,7 +4407,7 @@ error:
}
if (rest != NULL) {
- eap->nextcmd = (char *)check_nextcmd(rest);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)rest);
} else {
semsg(_(e_invarg2), arg);
}
@@ -4427,9 +4423,8 @@ error:
/// @param syncing true for ":syntax sync match .. "
static void syn_cmd_match(exarg_T *eap, int syncing)
{
- char_u *arg = (char_u *)eap->arg;
- char_u *group_name_end;
- char_u *rest;
+ char *arg = eap->arg;
+ char *group_name_end;
synpat_T item; // the item found in the line
int syn_id;
syn_opt_arg_T syn_opt_arg;
@@ -4437,7 +4432,7 @@ static void syn_cmd_match(exarg_T *eap, int syncing)
int conceal_char = NUL;
// Isolate the group name, check for validity
- rest = get_group_name(arg, &group_name_end);
+ char *rest = get_group_name(arg, &group_name_end);
// Get options before the pattern
syn_opt_arg.flags = 0;
@@ -4447,28 +4442,28 @@ static void syn_cmd_match(exarg_T *eap, int syncing)
syn_opt_arg.cont_list = NULL;
syn_opt_arg.cont_in_list = NULL;
syn_opt_arg.next_list = NULL;
- rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
// get the pattern.
init_syn_patterns();
CLEAR_FIELD(item);
- rest = get_syn_pattern(rest, &item);
+ rest = (char *)get_syn_pattern((char_u *)rest, &item);
if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL)) {
syn_opt_arg.flags |= HL_HAS_EOL;
}
// Get options after the pattern
- rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest != NULL) { // all arguments are valid
/*
* Check for trailing command and illegal trailing arguments.
*/
- eap->nextcmd = (char *)check_nextcmd(rest);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)rest);
if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
} else {
- if ((syn_id = syn_check_group((char *)arg, (size_t)(group_name_end - arg))) != 0) {
+ if ((syn_id = syn_check_group(arg, (size_t)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/*
* Store the pattern in the syn_items list
@@ -4525,12 +4520,12 @@ 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 = (char_u *)eap->arg;
- char_u *group_name_end;
- char_u *rest; // next arg, NULL on error
- char_u *key_end;
- char_u *key = NULL;
- char_u *p;
+ char *arg = eap->arg;
+ char *group_name_end;
+ char *rest; // next arg, NULL on error
+ char *key_end;
+ char *key = NULL;
+ char *p;
int item;
#define ITEM_START 0
#define ITEM_SKIP 1
@@ -4573,7 +4568,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
// get the options, patterns and matchgroup.
while (rest != NULL && !ends_excmd(*rest)) {
// Check for option arguments
- rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
+ rest = (char *)get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest)) {
break;
}
@@ -4584,7 +4579,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
key_end++;
}
xfree(key);
- key = vim_strnsave_up(rest, (size_t)(key_end - rest));
+ key = (char *)vim_strnsave_up((char_u *)rest, (size_t)(key_end - rest));
if (STRCMP(key, "MATCHGROUP") == 0) {
item = ITEM_MATCHGROUP;
} else if (STRCMP(key, "START") == 0) {
@@ -4600,30 +4595,30 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
} else {
break;
}
- rest = (char_u *)skipwhite((char *)key_end);
+ rest = skipwhite(key_end);
if (*rest != '=') {
rest = NULL;
semsg(_("E398: Missing '=': %s"), arg);
break;
}
- rest = (char_u *)skipwhite((char *)rest + 1);
+ rest = skipwhite(rest + 1);
if (*rest == NUL) {
not_enough = true;
break;
}
if (item == ITEM_MATCHGROUP) {
- p = skiptowhite(rest);
+ p = (char *)skiptowhite((char_u *)rest);
if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip) {
matchgroup_id = 0;
} else {
- matchgroup_id = syn_check_group((char *)rest, (size_t)(p - rest));
+ matchgroup_id = syn_check_group(rest, (size_t)(p - rest));
if (matchgroup_id == 0) {
illegal = true;
break;
}
}
- rest = (char_u *)skipwhite((char *)p);
+ rest = skipwhite(p);
} else {
/*
* Allocate room for a syn_pattern, and link it in the list of
@@ -4644,7 +4639,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
assert(item == ITEM_SKIP || item == ITEM_END);
reg_do_extmatch = REX_USE;
}
- rest = get_syn_pattern(rest, ppp->pp_synp);
+ rest = (char *)get_syn_pattern((char_u *)rest, ppp->pp_synp);
reg_do_extmatch = 0;
if (item == ITEM_END && vim_regcomp_had_eol()
&& !(syn_opt_arg.flags & HL_EXCLUDENL)) {
@@ -4671,12 +4666,12 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
* Check for trailing garbage or command.
* If OK, add the item.
*/
- eap->nextcmd = (char *)check_nextcmd(rest);
+ eap->nextcmd = (char *)check_nextcmd((char_u *)rest);
if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
} else {
ga_grow(&(curwin->w_s->b_syn_patterns), pat_count);
- if ((syn_id = syn_check_group((char *)arg, (size_t)(group_name_end - arg))) != 0) {
+ if ((syn_id = syn_check_group(arg, (size_t)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/*
* Store the start/skip/end in the syn_items list
@@ -4964,14 +4959,14 @@ static int syn_add_cluster(char_u *name)
*/
static void syn_cmd_cluster(exarg_T *eap, int syncing)
{
- char_u *arg = (char_u *)eap->arg;
- char_u *group_name_end;
- char_u *rest;
+ char *arg = eap->arg;
+ char *group_name_end;
+ char *rest;
bool got_clstr = false;
int opt_len;
int list_op;
- eap->nextcmd = (char *)find_nextcmd(arg);
+ eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
if (eap->skip) {
return;
}
@@ -4979,7 +4974,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
rest = get_group_name(arg, &group_name_end);
if (rest != NULL) {
- int scl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
+ int scl_id = syn_check_cluster((char_u *)arg, (int)(group_name_end - arg));
if (scl_id == 0) {
return;
}
@@ -5275,7 +5270,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
/// @param list where to store the resulting list, if not NULL, the list is silently skipped!
///
/// @return FAIL for some error, OK for success.
-static int get_id_list(char_u **const arg, const int keylen, int16_t **const list, const bool skip)
+static int get_id_list(char **const arg, const int keylen, int16_t **const list, const bool skip)
{
char *p = NULL;
char *end;
@@ -5292,7 +5287,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
// grow when a regexp is used. In that case round 1 is done once again.
for (int round = 1; round <= 2; round++) {
// skip "contains"
- p = skipwhite((char *)(*arg) + keylen);
+ p = skipwhite(*arg + keylen);
if (*p != '=') {
semsg(_("E405: Missing equal sign: %s"), *arg);
break;
@@ -5417,7 +5412,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
}
}
- *arg = (char_u *)p;
+ *arg = p;
if (failed || retval == NULL) {
xfree(retval);
return FAIL;
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 7d3d0f7905..2e5ce972d8 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -1780,7 +1780,7 @@ line_read_in:
// encoding to 'encoding'.
for (p = lbuf + 20; *p > ' ' && *p < 127; p++) {}
*p = NUL;
- convert_setup(&vimconv, lbuf + 20, p_enc);
+ convert_setup(&vimconv, lbuf + 20, (char_u *)p_enc);
}
// Read the next line. Unrecognized flags are ignored.
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 0126ad62b5..46f4d137c4 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -336,7 +336,7 @@ void vim_beep(unsigned val)
// When 'debug' contains "beep" produce a message. If we are sourcing
// a script or executing a function give the user a hint where the beep
// comes from.
- if (vim_strchr((char *)p_debug, 'e') != NULL) {
+ if (vim_strchr(p_debug, 'e') != NULL) {
msg_source(HL_ATTR(HLF_W));
msg_attr(_("Beep!"), HL_ATTR(HLF_W));
}
@@ -565,7 +565,7 @@ void ui_check_mouse(void)
// - 'a' is in 'mouse' and "c" is in MOUSE_A, or
// - the current buffer is a help file and 'h' is in 'mouse' and we are in a
// normal editing mode (not at hit-return message).
- for (char_u *p = p_mouse; *p; p++) {
+ for (char_u *p = (char_u *)p_mouse; *p; p++) {
switch (*p) {
case 'a':
if (vim_strchr(MOUSE_A, checkfor) != NULL) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index ac55066c7f..46e3a67388 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -2200,7 +2200,7 @@ void maybe_intro_message(void)
if (buf_is_empty(curbuf)
&& (curbuf->b_fname == NULL)
&& (firstwin->w_next == NULL)
- && (vim_strchr((char *)p_shm, SHM_INTRO) == NULL)) {
+ && (vim_strchr(p_shm, SHM_INTRO) == NULL)) {
intro_message(false);
}
}