Merge pull request #19957 from dundargoc/refactor/char_u/1

refactor: replace char_u with char
This commit is contained in:
bfredl 2022-08-26 23:07:56 +02:00 committed by GitHub
commit b0e052a8b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 526 additions and 534 deletions

View File

@ -686,7 +686,7 @@ const char *event_nr2name(event_T event)
static bool event_ignored(event_T event) static bool event_ignored(event_T event)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{ {
char *p = (char *)p_ei; char *p = p_ei;
while (*p != NUL) { while (*p != NUL) {
if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) { 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. // Return OK when the contents of p_ei is valid, FAIL otherwise.
int check_ei(void) int check_ei(void)
{ {
char *p = (char *)p_ei; char *p = p_ei;
while (*p) { while (*p) {
if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ',')) { 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. // Returns the old value of 'eventignore' in allocated memory.
char *au_event_disable(char *what) char *au_event_disable(char *what)
{ {
char *save_ei = (char *)vim_strsave(p_ei); char *save_ei = xstrdup(p_ei);
char *new_ei = (char *)vim_strnsave(p_ei, STRLEN(p_ei) + STRLEN(what)); char *new_ei = xstrnsave(p_ei, STRLEN(p_ei) + STRLEN(what));
if (*what == ',' && *p_ei == NUL) { if (*what == ',' && *p_ei == NUL) {
STRCPY(new_ei, what + 1); STRCPY(new_ei, what + 1);
} else { } else {

View File

@ -3167,14 +3167,14 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "titlestring", 0); use_sandbox = was_set_insecurely(curwin, "titlestring", 0);
build_stl_str_hl(curwin, buf, sizeof(buf), build_stl_str_hl(curwin, buf, sizeof(buf),
(char *)p_titlestring, use_sandbox, p_titlestring, use_sandbox,
0, maxlen, NULL, NULL); 0, maxlen, NULL, NULL);
title_str = buf; title_str = buf;
if (called_emsg > called_emsg_before) { if (called_emsg > called_emsg_before) {
set_string_option_direct("titlestring", -1, "", OPT_FREE, SID_ERROR); set_string_option_direct("titlestring", -1, "", OPT_FREE, SID_ERROR);
} }
} else { } else {
title_str = (char *)p_titlestring; title_str = p_titlestring;
} }
} else { } else {
// Format: "fname + (path) (1 of 2) - VIM". // Format: "fname + (path) (1 of 2) - VIM".
@ -3281,13 +3281,13 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "iconstring", 0); use_sandbox = was_set_insecurely(curwin, "iconstring", 0);
build_stl_str_hl(curwin, icon_str, sizeof(buf), build_stl_str_hl(curwin, icon_str, sizeof(buf),
(char *)p_iconstring, use_sandbox, p_iconstring, use_sandbox,
0, 0, NULL, NULL); 0, 0, NULL, NULL);
if (called_emsg > called_emsg_before) { if (called_emsg > called_emsg_before) {
set_string_option_direct("iconstring", -1, "", OPT_FREE, SID_ERROR); set_string_option_direct("iconstring", -1, "", OPT_FREE, SID_ERROR);
} }
} else { } else {
icon_str = (char *)p_iconstring; icon_str = p_iconstring;
} }
} else { } else {
char *buf_p; char *buf_p;

View File

@ -140,13 +140,13 @@ int buf_init_chartab(buf_T *buf, int global)
const char_u *p; const char_u *p;
if (i == 0) { if (i == 0) {
// first round: 'isident' // first round: 'isident'
p = p_isi; p = (char_u *)p_isi;
} else if (i == 1) { } else if (i == 1) {
// second round: 'isprint' // second round: 'isprint'
p = p_isp; p = (char_u *)p_isp;
} else if (i == 2) { } else if (i == 2) {
// third round: 'isfname' // third round: 'isfname'
p = p_isf; p = (char_u *)p_isf;
} else { // i == 3 } else { // i == 3
// fourth round: 'iskeyword' // fourth round: 'iskeyword'
p = (char_u *)buf->b_p_isk; p = (char_u *)buf->b_p_isk;

View File

@ -120,7 +120,7 @@ char *parse_shape_opt(int what)
} }
} }
// Repeat for all comma separated parts. // Repeat for all comma separated parts.
char *modep = (char *)p_guicursor; char *modep = p_guicursor;
while (modep != NULL && *modep != NUL) { while (modep != NULL && *modep != NUL) {
colonp = vim_strchr(modep, ':'); colonp = vim_strchr(modep, ':');
commap = vim_strchr(modep, ','); commap = vim_strchr(modep, ',');

View File

@ -2139,7 +2139,7 @@ int diffopt_changed(void)
long diff_algorithm_new = 0; long diff_algorithm_new = 0;
long diff_indent_heuristic = 0; long diff_indent_heuristic = 0;
char *p = (char *)p_dip; char *p = p_dip;
while (*p != NUL) { while (*p != NUL) {
if (STRNCMP(p, "filler", 6) == 0) { if (STRNCMP(p, "filler", 6) == 0) {
p += 6; p += 6;

View File

@ -4290,7 +4290,7 @@ static void ins_left(void)
revins_legal++; revins_legal++;
} }
revins_chars++; 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. // if 'whichwrap' set for cursor in insert mode may go to previous line.
// always break undo when moving upwards/downwards, else undo may break // always break undo when moving upwards/downwards, else undo may break
start_arrow(&tpos); start_arrow(&tpos);
@ -4383,7 +4383,7 @@ static void ins_right(void)
if (revins_chars) { if (revins_chars) {
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) { && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
// if 'whichwrap' set for cursor in insert mode, may move the // if 'whichwrap' set for cursor in insert mode, may move the
// cursor to the next line // cursor to the next line

View File

@ -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_CC_TO, enc_to, -1);
set_vim_var_string(VV_FNAME_IN, fname_from, -1); set_vim_var_string(VV_FNAME_IN, fname_from, -1);
set_vim_var_string(VV_FNAME_OUT, fname_to, -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; err = true;
} }
set_vim_var_string(VV_CC_FROM, NULL, -1); 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_FNAME_IN, fname, -1);
set_vim_var_string(VV_CMDARG, args, -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; err = true;
} }
set_vim_var_string(VV_FNAME_IN, NULL, -1); 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_IN, origfile, -1);
set_vim_var_string(VV_FNAME_NEW, newfile, -1); set_vim_var_string(VV_FNAME_NEW, newfile, -1);
set_vim_var_string(VV_FNAME_OUT, outfile, -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_IN, NULL, -1);
set_vim_var_string(VV_FNAME_NEW, NULL, -1); set_vim_var_string(VV_FNAME_NEW, NULL, -1);
set_vim_var_string(VV_FNAME_OUT, 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) { if (vimruntime_env == NULL) {
emsg(_("E5009: $VIMRUNTIME is empty or unset")); emsg(_("E5009: $VIMRUNTIME is empty or unset"));
} else { } else {
bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env); bool rtp_ok = NULL != strstr(p_rtp, vimruntime_env);
if (rtp_ok) { if (rtp_ok) {
semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env); semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
} else { } else {

View File

@ -8379,7 +8379,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
conv.vc_type = CONV_NONE; conv.vc_type = CONV_NONE;
enc = enc_locale(); enc = enc_locale();
convert_setup(&conv, p_enc, enc); convert_setup(&conv, (char_u *)p_enc, enc);
if (conv.vc_type != CONV_NONE) { if (conv.vc_type != CONV_NONE) {
p = (char *)string_convert(&conv, (char_u *)p, NULL); 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) { if (conv.vc_type != CONV_NONE) {
xfree(p); xfree(p);
} }
convert_setup(&conv, enc, p_enc); convert_setup(&conv, enc, (char_u *)p_enc);
if (conv.vc_type != CONV_NONE) { if (conv.vc_type != CONV_NONE) {
rettv->vval.v_string = (char *)string_convert(&conv, (char_u *)result_buf, NULL); rettv->vval.v_string = (char *)string_convert(&conv, (char_u *)result_buf, NULL);
} else { } else {
@ -8639,7 +8639,7 @@ static void f_strptime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
.vc_type = CONV_NONE, .vc_type = CONV_NONE,
}; };
char_u *enc = enc_locale(); 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) { if (conv.vc_type != CONV_NONE) {
fmt = (char *)string_convert(&conv, (char_u *)fmt, NULL); fmt = (char *)string_convert(&conv, (char_u *)fmt, NULL);
} }

View File

@ -2040,7 +2040,7 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char *fname, char *ffname, int oth
STRCPY(dir, "."); STRCPY(dir, ".");
} else { } else {
dir = xmalloc(MAXPATHL); dir = xmalloc(MAXPATHL);
p = (char *)p_dir; p = p_dir;
copy_option_part(&p, dir, MAXPATHL, ","); copy_option_part(&p, dir, MAXPATHL, ",");
} }
swapname = (char *)makeswapname((char_u *)fname, (char_u *)ffname, curbuf, (char_u *)dir); 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) long cmdpreview_ns, handle_T cmdpreview_bufnr)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
char *save_shm_p = (char *)vim_strsave(p_shm); char *save_shm_p = xstrdup(p_shm);
PreviewLines lines = *preview_lines; PreviewLines lines = *preview_lines;
buf_T *orig_buf = curbuf; buf_T *orig_buf = curbuf;
// We keep a special-purpose buffer around, but don't assume it exists. // We keep a special-purpose buffer around, but don't assume it exists.

View File

@ -543,7 +543,7 @@ void ex_listdo(exarg_T *eap)
if (curwin->w_arg_idx != i || !editing_arg_idx(curwin)) { if (curwin->w_arg_idx != i || !editing_arg_idx(curwin)) {
// Clear 'shm' to avoid that the file message overwrites // Clear 'shm' to avoid that the file message overwrites
// any output from the command. // 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); set_option_value_give_err("shm", 0L, "", 0);
do_argfile(eap, i); do_argfile(eap, i);
set_option_value_give_err("shm", 0L, p_shm_save, 0); 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 // Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command. // 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); set_option_value_give_err("shm", 0L, "", 0);
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum); goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
set_option_value_give_err("shm", 0L, p_shm_save, 0); 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 // Clear 'shm' to avoid that the file message overwrites
// any output from the command. // 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); set_option_value_give_err("shm", 0L, "", 0);
ex_cnext(eap); ex_cnext(eap);
set_option_value_give_err("shm", 0L, p_shm_save, 0); set_option_value_give_err("shm", 0L, p_shm_save, 0);

View File

@ -2580,7 +2580,7 @@ static void apply_cmdmod(cmdmod_T *cmod)
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL) { if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL) {
// Set 'eventignore' to "all". // Set 'eventignore' to "all".
// First save the existing option value for restoring it later. // 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); set_string_option_direct("ei", -1, "all", OPT_FREE, SID_NONE);
} }
} }
@ -6954,16 +6954,16 @@ char *expand_sfile(char *arg)
/// ":rshada" and ":wshada". /// ":rshada" and ":wshada".
static void ex_shada(exarg_T *eap) static void ex_shada(exarg_T *eap)
{ {
char *save_shada = (char *)p_shada; char *save_shada = p_shada;
if (*p_shada == NUL) { if (*p_shada == NUL) {
p_shada = (char_u *)"'100"; p_shada = "'100";
} }
if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) { if (eap->cmdidx == CMD_rviminfo || eap->cmdidx == CMD_rshada) {
(void)shada_read_everything(eap->arg, eap->forceit, false); (void)shada_read_everything(eap->arg, eap->forceit, false);
} else { } else {
shada_write_file(eap->arg, eap->forceit); 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]". /// Make a dialog message in "buff[DIALOG_MSG_SIZE]".

View File

@ -634,7 +634,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
.ignore_drag_release = true, .ignore_drag_release = true,
}; };
CommandLineState *s = &state; 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); init_incsearch_state(&s->is_state);
CmdlineInfo save_ccline; CmdlineInfo save_ccline;
bool did_save_ccline = false; bool did_save_ccline = false;
@ -2538,7 +2538,6 @@ char_u *get_cmdprompt(void)
int check_opt_wim(void) int check_opt_wim(void)
{ {
char_u new_wim_flags[4]; char_u new_wim_flags[4];
char_u *p;
int i; int i;
int idx = 0; int idx = 0;
@ -2546,7 +2545,7 @@ int check_opt_wim(void)
new_wim_flags[i] = 0; 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++) {} for (i = 0; ASCII_ISALPHA(p[i]); i++) {}
if (p[i] != NUL && p[i] != ',' && p[i] != ':') { if (p[i] != NUL && p[i] != ',' && p[i] != ':') {
return FAIL; return FAIL;
@ -4090,7 +4089,7 @@ char *check_cedit(void)
if (*p_cedit == NUL) { if (*p_cedit == NUL) {
cedit_key = -1; cedit_key = -1;
} else { } else {
n = string_to_key(p_cedit); n = string_to_key((char_u *)p_cedit);
if (vim_isprintc(n)) { if (vim_isprintc(n)) {
return e_invarg; return e_invarg;
} }

View File

@ -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 = curbuf->b_p_fenc; // use format from buffer
fenc_alloced = false; fenc_alloced = false;
} else { } 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); 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) { if (*p_bex == NUL) {
backup_ext = ".bak"; backup_ext = ".bak";
} else { } else {
backup_ext = (char *)p_bex; backup_ext = p_bex;
} }
if (backup_copy) { 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 * For these reasons, the existing writable file must be truncated
* and reused. Creation of a backup COPY will be attempted. * and reused. Creation of a backup COPY will be attempted.
*/ */
dirp = (char *)p_bdir; dirp = p_bdir;
while (*dirp) { while (*dirp) {
/* /*
* Isolate one directory name, using an entry in 'bdir'. * 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 * path/fo.o.h.bak Try all directories in 'backupdir', first one
* that works is used. * that works is used.
*/ */
dirp = (char *)p_bdir; dirp = p_bdir;
while (*dirp) { while (*dirp) {
/* /*
* Isolate one directory name and make the backup file name. * Isolate one directory name and make the backup file name.
@ -3572,7 +3572,7 @@ restore_backup:
* the backup file our 'original' file. * the backup file our 'original' file.
*/ */
if (*p_pm && dobackup) { if (*p_pm && dobackup) {
char *const org = modname(fname, (char *)p_pm, false); char *const org = modname(fname, p_pm, false);
if (backup != NULL) { if (backup != NULL) {
/* /*
@ -4172,7 +4172,7 @@ static bool need_conversion(const char_u *fenc)
} else { } else {
// Ignore difference between "ansi" and "latin1", "ucs-4" and // Ignore difference between "ansi" and "latin1", "ucs-4" and
// "ucs-4be", etc. // "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); fenc_flags = get_fio_flags(fenc);
same_encoding = (enc_flags != 0 && fenc_flags == enc_flags); same_encoding = (enc_flags != 0 && fenc_flags == enc_flags);
} }
@ -4196,7 +4196,7 @@ static int get_fio_flags(const char_u *name)
int prop; int prop;
if (*name == NUL) { if (*name == NUL) {
name = p_enc; name = (char_u *)p_enc;
} }
prop = enc_canon_props(name); prop = enc_canon_props(name);
if (prop & ENC_UNICODE) { if (prop & ENC_UNICODE) {

View File

@ -264,7 +264,7 @@ struct prt_resfile_buffer_S {
*/ */
char *parse_printoptions(void) 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) 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. * Set up font and encoding.
*/ */
p_encoding = enc_skip(p_penc); p_encoding = enc_skip((char_u *)p_penc);
if (*p_encoding == NUL) { 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. // 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; p_mbenc_first = p_mbenc;
effective_cmap = cmap; 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; break;
} }
} }
@ -2330,7 +2330,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
* Set up the font size. * Set up the font size.
*/ */
fontsize = PRT_PS_DEFAULT_FONTSIZE; 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])) { if (p[1] == 'h' && ascii_isdigit(p[2])) {
fontsize = atoi((char *)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". // that cannot be found then default to "latin1".
// Note: VIM specific encoding header is always skipped. // Note: VIM specific encoding header is always skipped.
if (!prt_out_mbyte) { if (!prt_out_mbyte) {
p_encoding = (char *)enc_skip(p_penc); p_encoding = (char *)enc_skip((char_u *)p_penc);
if (*p_encoding == NUL if (*p_encoding == NUL
|| !prt_find_resource(p_encoding, &res_encoding)) { || !prt_find_resource(p_encoding, &res_encoding)) {
// 'printencoding' not set or not supported - find alternate // 'printencoding' not set or not supported - find alternate
int props; 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); props = enc_canon_props((char_u *)p_encoding);
if (!(props & ENC_8BIT) if (!(props & ENC_8BIT)
|| !prt_find_resource(p_encoding, &res_encoding)) { || !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 // For the moment there are no checks on encoding resource files to
// perform // perform
} else { } else {
p_encoding = (char *)enc_skip(p_penc); p_encoding = (char *)enc_skip((char_u *)p_penc);
if (*p_encoding == NUL) { if (*p_encoding == NUL) {
p_encoding = (char *)enc_skip(p_enc); p_encoding = (char *)enc_skip((char_u *)p_enc);
} }
if (prt_use_courier) { if (prt_use_courier) {
// Include ASCII range encoding vector // Include ASCII range encoding vector
@ -2640,9 +2640,9 @@ bool mch_print_begin(prt_settings_T *psettings)
} }
prt_conv.vc_type = CONV_NONE; 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 // 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\""), semsg(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding); p_encoding);
return false; return false;

View File

@ -137,7 +137,7 @@ void ex_help(exarg_T *eap)
} else { } else {
// There is no help window yet. // There is no help window yet.
// Try to open the file specified by the "helpfile" option. // 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); smsg(_("Sorry, help file \"%s\" not found"), p_hf);
goto erret; goto erret;
} }
@ -701,7 +701,7 @@ void fix_help_buffer(void)
// Go through all directories in 'runtimepath', skipping // Go through all directories in 'runtimepath', skipping
// $VIMRUNTIME. // $VIMRUNTIME.
char *p = (char *)p_rtp; char *p = p_rtp;
while (*p != NUL) { while (*p != NUL) {
copy_option_part(&p, (char *)NameBuff, MAXPATHL, ","); copy_option_part(&p, (char *)NameBuff, MAXPATHL, ",");
char *const rt = vim_getenv("VIMRUNTIME"); char *const rt = vim_getenv("VIMRUNTIME");
@ -804,7 +804,7 @@ void fix_help_buffer(void)
vc.vc_type = CONV_NONE; vc.vc_type = CONV_NONE;
convert_setup(&vc, convert_setup(&vc,
(char_u *)(this_utf == kTrue ? "utf-8" : "latin1"), (char_u *)(this_utf == kTrue ? "utf-8" : "latin1"),
p_enc); (char_u *)p_enc);
if (vc.vc_type == CONV_NONE) { if (vc.vc_type == CONV_NONE) {
// No conversion needed. // No conversion needed.
cp = (char *)IObuff; cp = (char *)IObuff;
@ -1163,7 +1163,7 @@ void ex_helptags(exarg_T *eap)
} }
if (STRCMP(eap->arg, "ALL") == 0) { 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 { } else {
ExpandInit(&xpc); ExpandInit(&xpc);
xpc.xp_context = EXPAND_DIRECTORIES; xpc.xp_context = EXPAND_DIRECTORIES;

View File

@ -757,7 +757,7 @@ err_closing:
#endif #endif
// expand the cscope exec for env var's // expand the cscope exec for env var's
prog = xmalloc(MAXPATHL + 1); 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 // alloc space to hold the cscope command
size_t len = strlen(prog) + strlen(csinfo[i].fname) + 32; 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]; cmdletter = opt[0];
} }
qfpos = vim_strchr((char *)p_csqf, cmdletter); qfpos = vim_strchr(p_csqf, cmdletter);
if (qfpos != NULL) { if (qfpos != NULL) {
qfpos++; qfpos++;
// next symbol must be + or - // next symbol must be + or -

View File

@ -1008,10 +1008,10 @@ void completeopt_was_set(void)
{ {
compl_no_insert = false; compl_no_insert = false;
compl_no_select = false; compl_no_select = false;
if (strstr((char *)p_cot, "noselect") != NULL) { if (strstr(p_cot, "noselect") != NULL) {
compl_no_select = true; compl_no_select = true;
} }
if (strstr((char *)p_cot, "noinsert") != NULL) { if (strstr(p_cot, "noinsert") != NULL) {
compl_no_insert = true; compl_no_insert = true;
} }
} }
@ -1037,7 +1037,7 @@ bool pum_wanted(void)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{ {
// "completeopt" must contain "menu" or "menuone" // "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. /// 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; compl = compl->cp_next;
} while (!is_first_match(compl)); } while (!is_first_match(compl));
if (strstr((char *)p_cot, "menuone") != NULL) { if (strstr(p_cot, "menuone") != NULL) {
return i >= 1; return i >= 1;
} }
return i >= 2; return i >= 2;
@ -2105,7 +2105,7 @@ bool ins_compl_prep(int c)
// Set "compl_get_longest" when finding the first matches. // Set "compl_get_longest" when finding the first matches.
if (ctrl_x_mode_not_defined_yet() if (ctrl_x_mode_not_defined_yet()
|| (ctrl_x_mode_normal() && !compl_started)) { || (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; compl_used_match = true;
} }
@ -2229,7 +2229,7 @@ static char_u *get_complete_funcname(int type)
case CTRL_X_OMNI: case CTRL_X_OMNI:
return (char_u *)curbuf->b_p_ofu; return (char_u *)curbuf->b_p_ofu;
case CTRL_X_THESAURUS: 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: default:
return (char_u *)""; 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 ins_compl_dictionaries(dict != NULL ? dict
: (compl_type == CTRL_X_THESAURUS : (compl_type == CTRL_X_THESAURUS
? (*curbuf->b_p_tsr == NUL ? p_tsr : (char_u *)curbuf->b_p_tsr) ? (*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, (char_u *)compl_pattern,
dict != NULL ? dict_f : 0, dict != NULL ? dict_f : 0,
compl_type == CTRL_X_THESAURUS); compl_type == CTRL_X_THESAURUS);

View File

@ -1733,7 +1733,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
if (i == 1) { if (i == 1) {
char buf[100]; char buf[100];
p_shm_save = xstrdup((char *)p_shm); p_shm_save = xstrdup(p_shm);
snprintf(buf, sizeof(buf), "F%s", p_shm); snprintf(buf, sizeof(buf), "F%s", p_shm);
set_option_value_give_err("shm", 0L, buf, 0); set_option_value_give_err("shm", 0L, buf, 0);
} }

View File

@ -2322,7 +2322,7 @@ void langmap_set(void)
ga_clear(&langmap_mapga); // clear the previous map first ga_clear(&langmap_mapga); // clear the previous map first
langmap_init(); // back to one-to-one map 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] != ';'; for (p2 = p; p2[0] != NUL && p2[0] != ',' && p2[0] != ';';
MB_PTR_ADV(p2)) { MB_PTR_ADV(p2)) {
if (p2[0] == '\\' && p2[1] != NUL) { if (p2[0] == '\\' && p2[1] != NUL) {

View File

@ -1936,7 +1936,7 @@ void utf_find_illegal(void)
// 'encoding' is "utf-8" but we are editing a 8-bit encoded file, // 'encoding' is "utf-8" but we are editing a 8-bit encoded file,
// possibly a utf-8 file with illegal bytes. Setup for conversion // possibly a utf-8 file with illegal bytes. Setup for conversion
// from utf-8 to 'fileencoding'. // 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; curwin->w_cursor.coladd = 0;

View File

@ -399,7 +399,7 @@ void ml_setname(buf_T *buf)
} }
// Try all directories in the 'directory' option. // Try all directories in the 'directory' option.
dirp = (char *)p_dir; dirp = p_dir;
bool found_existing_dir = false; bool found_existing_dir = false;
for (;;) { for (;;) {
if (*dirp == NUL) { // tried all directories, fail if (*dirp == NUL) { // tried all directories, fail
@ -490,7 +490,7 @@ void ml_open_file(buf_T *buf)
} }
// Try all directories in 'directory' option. // Try all directories in 'directory' option.
dirp = (char *)p_dir; dirp = p_dir;
bool found_existing_dir = false; bool found_existing_dir = false;
for (;;) { for (;;) {
if (*dirp == NUL) { 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'. // Do the loop for every directory in 'directory'.
// First allocate some memory to put the directory name in. // First allocate some memory to put the directory name in.
dir_name = xmalloc(STRLEN(p_dir) + 1); dir_name = xmalloc(STRLEN(p_dir) + 1);
dirp = (char *)p_dir; dirp = p_dir;
while (*dirp) { while (*dirp) {
// Isolate a directory name from *dirp and put it in dir_name (we know // Isolate a directory name from *dirp and put it in dir_name (we know
// it is large enough, so use 31000 for length). // 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 // give the ATTENTION message when there is an old swap file
// for the current file, and the buffer was not recovered. // for the current file, and the buffer was not recovered.
if (differ == false && !(curbuf->b_flags & BF_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; int choice = 0;
process_still_running = false; process_still_running = false;

View File

@ -640,8 +640,8 @@ void msg_source(int attr)
/// If "emsg_skip" is set: never do error messages. /// If "emsg_skip" is set: never do error messages.
int emsg_not_now(void) int emsg_not_now(void)
{ {
if ((emsg_off > 0 && vim_strchr((char *)p_debug, 'm') == NULL if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL
&& vim_strchr((char *)p_debug, 't') == NULL) && vim_strchr(p_debug, 't') == NULL)
|| emsg_skip > 0) { || emsg_skip > 0) {
return true; return true;
} }
@ -665,7 +665,7 @@ static bool emsg_multiline(const char *s, bool multiline)
bool severe = emsg_severe; bool severe = emsg_severe;
emsg_severe = false; 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 // Cause a throw of an error exception if appropriate. Don't display
// the error message in this case. (If no matching catch clause will // the error message in this case. (If no matching catch clause will
// be found, the message will be displayed later on.) "ignore" is set // be found, the message will be displayed later on.) "ignore" is set

View File

@ -2653,11 +2653,11 @@ void clear_showcmd(void)
lines = bot - top + 1; lines = bot - top + 1;
if (VIsual_mode == Ctrl_V) { 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; char *const saved_w_sbr = curwin->w_p_sbr;
// Make 'sbr' empty for a moment to get the correct size. // 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; curwin->w_p_sbr = empty_option;
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol); getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
p_sbr = saved_sbr; p_sbr = saved_sbr;
@ -4567,9 +4567,9 @@ static void nv_right(cmdarg_T *cap)
// <Space> wraps to next line if 'whichwrap' has 's'. // <Space> wraps to next line if 'whichwrap' has 's'.
// 'l' wraps to next line if 'whichwrap' has 'l'. // 'l' wraps to next line if 'whichwrap' has 'l'.
// CURS_RIGHT wraps to next line if 'whichwrap' has '>'. // CURS_RIGHT wraps to next line if 'whichwrap' has '>'.
if (((cap->cmdchar == ' ' && vim_strchr((char *)p_ww, 's') != NULL) if (((cap->cmdchar == ' ' && vim_strchr(p_ww, 's') != NULL)
|| (cap->cmdchar == 'l' && vim_strchr((char *)p_ww, 'l') != NULL) || (cap->cmdchar == 'l' && vim_strchr(p_ww, 'l') != NULL)
|| (cap->cmdchar == K_RIGHT && vim_strchr((char *)p_ww, '>') != NULL)) || (cap->cmdchar == K_RIGHT && vim_strchr(p_ww, '>') != NULL))
&& curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
// When deleting we also count the NL as a character. // When deleting we also count the NL as a character.
// Set cap->oap->inclusive when last char in the line is // 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'. // 'h' wraps to previous line if 'whichwrap' has 'h'.
// CURS_LEFT wraps to previous line if 'whichwrap' has '<'. // CURS_LEFT wraps to previous line if 'whichwrap' has '<'.
if ((((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H) if ((((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H)
&& vim_strchr((char *)p_ww, 'b') != NULL) && vim_strchr(p_ww, 'b') != NULL)
|| (cap->cmdchar == 'h' && vim_strchr((char *)p_ww, 'h') != NULL) || (cap->cmdchar == 'h' && vim_strchr(p_ww, 'h') != NULL)
|| (cap->cmdchar == K_LEFT && vim_strchr((char *)p_ww, '<') != NULL)) || (cap->cmdchar == K_LEFT && vim_strchr(p_ww, '<') != NULL))
&& curwin->w_cursor.lnum > 1) { && curwin->w_cursor.lnum > 1) {
curwin->w_cursor.lnum--; curwin->w_cursor.lnum--;
coladvance(MAXCOL); coladvance(MAXCOL);
@ -5553,7 +5553,7 @@ static void n_swapchar(cmdarg_T *cap)
return; 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); clearopbeep(cap->oap);
return; return;
} }
@ -5569,7 +5569,7 @@ static void n_swapchar(cmdarg_T *cap)
did_change |= swapchar(cap->oap->op_type, &curwin->w_cursor); did_change |= swapchar(cap->oap->op_type, &curwin->w_cursor);
inc_cursor(); inc_cursor();
if (gchar_cursor() == NUL) { 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 < curbuf->b_ml.ml_line_count) {
curwin->w_cursor.lnum++; curwin->w_cursor.lnum++;
curwin->w_cursor.col = 0; curwin->w_cursor.col = 0;
@ -5901,7 +5901,7 @@ void start_selection(void)
void may_start_select(int c) void may_start_select(int c)
{ {
VIsual_select = (c == 'o' || (stuff_empty() && typebuf_typed())) 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". /// Start Visual mode "c".

View File

@ -5334,17 +5334,16 @@ void cursor_pos_info(dict_T *dict)
} }
if (l_VIsual_mode == Ctrl_V) { 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; char *const saved_w_sbr = curwin->w_p_sbr;
// Make 'sbr' empty for a moment to get the correct size. // 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; curwin->w_p_sbr = empty_option;
oparg.is_VIsual = true; oparg.is_VIsual = true;
oparg.motion_type = kMTBlockWise; oparg.motion_type = kMTBlockWise;
oparg.op_type = OP_NOP; oparg.op_type = OP_NOP;
getvcols(curwin, &min_pos, &max_pos, getvcols(curwin, &min_pos, &max_pos, &oparg.start_vcol, &oparg.end_vcol);
&oparg.start_vcol, &oparg.end_vcol);
p_sbr = saved_sbr; p_sbr = saved_sbr;
curwin->w_p_sbr = saved_w_sbr; curwin->w_p_sbr = saved_w_sbr;
if (curwin->w_curswant == MAXCOL) { if (curwin->w_curswant == MAXCOL) {
@ -5507,14 +5506,14 @@ void cursor_pos_info(dict_T *dict)
} }
if (dict == NULL) { if (dict == NULL) {
// Don't shorten this message, the user asked for it. // Don't shorten this message, the user asked for it.
p = p_shm; p = (char_u *)p_shm;
p_shm = (char_u *)""; p_shm = "";
if (p_ch < 1) { if (p_ch < 1) {
msg_start(); msg_start();
msg_scroll = true; msg_scroll = true;
} }
msg((char *)IObuff); msg((char *)IObuff);
p_shm = p; p_shm = (char *)p;
} }
} }
@ -5589,7 +5588,7 @@ static Callback opfunc_cb;
/// @return OK or FAIL /// @return OK or FAIL
int set_operatorfunc_option(void) 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) #if defined(EXITFREE)

View File

@ -439,7 +439,7 @@ void set_init_1(bool clean_arg)
#ifdef HAVE_WORKING_LIBINTL #ifdef HAVE_WORKING_LIBINTL
// GNU gettext 0.10.37 supports this feature: set the codeset used for // GNU gettext 0.10.37 supports this feature: set the codeset used for
// translated messages independently from the current locale. // 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 #endif
// Set the default for 'helplang'. // 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 // for ":set" on local options. Note: when setting
// 'syntax' or 'filetype' autocommands may be // 'syntax' or 'filetype' autocommands may be
// triggered that can cause havoc. // 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), errbuf, sizeof(errbuf),
opt_flags, &value_checked); 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. /// Return NULL if the parameter is not specified in the string.
char_u *find_shada_parameter(int type) char_u *find_shada_parameter(int type)
{ {
char_u *p; for (char *p = p_shada; *p; p++) {
for (p = p_shada; *p; p++) {
if (*p == type) { if (*p == type) {
return p + 1; return (char_u *)p + 1;
} }
if (*p == 'n') { // 'n' is always the last one if (*p == 'n') { // 'n' is always the last one
break; 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 if (p == NULL) { // hit the end without finding parameter
break; break;
} }
@ -1745,7 +1743,7 @@ static char_u *option_expand(int opt_idx, char_u *val)
*/ */
expand_env_esc(val, NameBuff, MAXPATHL, expand_env_esc(val, NameBuff, MAXPATHL,
(char_u **)options[opt_idx].var == &p_tags, false, (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); NULL);
if (STRCMP(NameBuff, val) == 0) { // they are the same if (STRCMP(NameBuff, val) == 0) { // they are the same
return NULL; return NULL;
@ -2883,7 +2881,7 @@ bool set_tty_option(const char *name, char *value)
void set_tty_background(const 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 // background is already set... ignore
return; return;
} }
@ -4449,7 +4447,7 @@ void buf_copy_options(buf_T *buf, int flags)
if (!buf->b_p_initialized) { if (!buf->b_p_initialized) {
free_buf_options(buf, true); free_buf_options(buf, true);
buf->b_p_ro = false; // don't copy readonly 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) { switch (*p_ffs) {
case 'm': case 'm':
buf->b_p_ff = xstrdup(FF_MAC); 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); buf->b_p_ff = xstrdup(FF_UNIX);
break; break;
default: default:
buf->b_p_ff = (char *)vim_strsave(p_ff); buf->b_p_ff = xstrdup(p_ff);
break; break;
} }
buf->b_p_bh = empty_option; 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); buf->b_p_csl = vim_strsave(p_csl);
COPY_OPT_SCTX(buf, BV_CSL); COPY_OPT_SCTX(buf, BV_CSL);
#endif #endif
buf->b_p_cfu = (char *)vim_strsave(p_cfu); buf->b_p_cfu = xstrdup(p_cfu);
COPY_OPT_SCTX(buf, BV_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); COPY_OPT_SCTX(buf, BV_OFU);
buf->b_p_tfu = (char *)vim_strsave(p_tfu); buf->b_p_tfu = (char *)vim_strsave(p_tfu);
COPY_OPT_SCTX(buf, BV_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 buf->b_p_vsts_nopaste = p_vsts_nopaste
? (char *)vim_strsave(p_vsts_nopaste) ? (char *)vim_strsave(p_vsts_nopaste)
: NULL; : NULL;
buf->b_p_com = (char *)vim_strsave(p_com); buf->b_p_com = xstrdup(p_com);
COPY_OPT_SCTX(buf, BV_COM); COPY_OPT_SCTX(buf, BV_COM);
buf->b_p_cms = (char *)vim_strsave(p_cms); buf->b_p_cms = (char *)vim_strsave(p_cms);
COPY_OPT_SCTX(buf, BV_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); COPY_OPT_SCTX(buf, BV_CI);
buf->b_p_cin = p_cin; buf->b_p_cin = p_cin;
COPY_OPT_SCTX(buf, BV_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); 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); 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); COPY_OPT_SCTX(buf, BV_CINSD);
// Don't copy 'filetype', it must be detected // Don't copy 'filetype', it must be detected
buf->b_p_ft = empty_option; buf->b_p_ft = empty_option;
buf->b_p_pi = p_pi; buf->b_p_pi = p_pi;
COPY_OPT_SCTX(buf, BV_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); COPY_OPT_SCTX(buf, BV_CINW);
buf->b_p_lisp = p_lisp; buf->b_p_lisp = p_lisp;
COPY_OPT_SCTX(buf, BV_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_fp = empty_option;
buf->b_p_fex = (char *)vim_strsave(p_fex); buf->b_p_fex = (char *)vim_strsave(p_fex);
COPY_OPT_SCTX(buf, BV_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); COPY_OPT_SCTX(buf, BV_SUA);
buf->b_p_keymap = (char *)vim_strsave(p_keymap); buf->b_p_keymap = (char *)vim_strsave(p_keymap);
COPY_OPT_SCTX(buf, BV_KMAP); 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; buf->b_p_vts_array = NULL;
} }
} else { } else {
buf->b_p_isk = (char *)vim_strsave(p_isk); buf->b_p_isk = xstrdup(p_isk);
COPY_OPT_SCTX(buf, BV_ISK); COPY_OPT_SCTX(buf, BV_ISK);
did_isk = true; did_isk = true;
buf->b_p_ts = p_ts; buf->b_p_ts = p_ts;
@ -5052,8 +5050,8 @@ static int wc_use_keyname(char_u *varp, long *wcp)
bool shortmess(int x) bool shortmess(int x)
{ {
return (p_shm != NULL return (p_shm != NULL
&& (vim_strchr((char *)p_shm, x) != NULL && (vim_strchr(p_shm, x) != NULL
|| (vim_strchr((char *)p_shm, 'a') != NULL || (vim_strchr(p_shm, 'a') != NULL
&& vim_strchr((char *)SHM_ALL_ABBREVIATIONS, x) != NULL))); && vim_strchr((char *)SHM_ALL_ABBREVIATIONS, x) != NULL)));
} }
@ -5354,7 +5352,7 @@ bool can_bs(int what)
case '0': case '0':
return false; 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'. /// 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 FUNC_ATTR_WARN_UNUSED_RESULT
{ {
if (win->w_p_sbr == NULL || *win->w_p_sbr == NUL) { 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) { if (STRCMP(win->w_p_sbr, "NONE") == 0) {
return (char_u *)empty_option; return (char_u *)empty_option;

View File

@ -384,7 +384,7 @@ enum {
*/ */
EXTERN long p_aleph; // 'aleph' EXTERN long p_aleph; // 'aleph'
EXTERN char_u *p_ambw; ///< 'ambiwidth' EXTERN char *p_ambw; ///< 'ambiwidth'
EXTERN int p_acd; ///< 'autochdir' EXTERN int p_acd; ///< 'autochdir'
EXTERN int p_ai; ///< 'autoindent' EXTERN int p_ai; ///< 'autoindent'
EXTERN int p_bin; ///< 'binary' EXTERN int p_bin; ///< 'binary'
@ -392,29 +392,29 @@ EXTERN int p_bomb; ///< 'bomb'
EXTERN int p_bl; ///< 'buflisted' EXTERN int p_bl; ///< 'buflisted'
EXTERN int p_cin; ///< 'cindent' EXTERN int p_cin; ///< 'cindent'
EXTERN long p_channel; ///< 'channel' EXTERN long p_channel; ///< 'channel'
EXTERN char_u *p_cink; ///< 'cinkeys' EXTERN char *p_cink; ///< 'cinkeys'
EXTERN char_u *p_cinsd; ///< 'cinscopedecls' EXTERN char *p_cinsd; ///< 'cinscopedecls'
EXTERN char_u *p_cinw; ///< 'cinwords' EXTERN char *p_cinw; ///< 'cinwords'
EXTERN char_u *p_cfu; ///< 'completefunc' EXTERN char *p_cfu; ///< 'completefunc'
EXTERN char_u *p_ofu; ///< 'omnifunc' EXTERN char *p_ofu; ///< 'omnifunc'
EXTERN char_u *p_tsrfu; ///< 'thesaurusfunc' EXTERN char *p_tsrfu; ///< 'thesaurusfunc'
EXTERN int p_ci; ///< 'copyindent' EXTERN int p_ci; ///< 'copyindent'
EXTERN int p_ar; // 'autoread' EXTERN int p_ar; // 'autoread'
EXTERN int p_aw; // 'autowrite' EXTERN int p_aw; // 'autowrite'
EXTERN int p_awa; // 'autowriteall' EXTERN int p_awa; // 'autowriteall'
EXTERN char_u *p_bs; // 'backspace' EXTERN char *p_bs; // 'backspace'
EXTERN char_u *p_bg; // 'background' EXTERN char *p_bg; // 'background'
EXTERN int p_bk; // 'backup' EXTERN int p_bk; // 'backup'
EXTERN char_u *p_bkc; // 'backupcopy' EXTERN char *p_bkc; // 'backupcopy'
EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy' EXTERN unsigned int bkc_flags; ///< flags from 'backupcopy'
#define BKC_YES 0x001 #define BKC_YES 0x001
#define BKC_AUTO 0x002 #define BKC_AUTO 0x002
#define BKC_NO 0x004 #define BKC_NO 0x004
#define BKC_BREAKSYMLINK 0x008 #define BKC_BREAKSYMLINK 0x008
#define BKC_BREAKHARDLINK 0x010 #define BKC_BREAKHARDLINK 0x010
EXTERN char_u *p_bdir; // 'backupdir' EXTERN char *p_bdir; // 'backupdir'
EXTERN char_u *p_bex; // 'backupext' EXTERN char *p_bex; // 'backupext'
EXTERN char_u *p_bo; // 'belloff' EXTERN char *p_bo; // 'belloff'
EXTERN char breakat_flags[256]; // which characters are in 'breakat' EXTERN char breakat_flags[256]; // which characters are in 'breakat'
EXTERN unsigned bo_flags; EXTERN unsigned bo_flags;
@ -443,16 +443,16 @@ EXTERN char_u *p_bsk; // 'backupskip'
EXTERN char_u *p_breakat; // 'breakat' EXTERN char_u *p_breakat; // 'breakat'
EXTERN char_u *p_bh; ///< 'bufhidden' EXTERN char_u *p_bh; ///< 'bufhidden'
EXTERN char_u *p_bt; ///< 'buftype' EXTERN char_u *p_bt; ///< 'buftype'
EXTERN char_u *p_cmp; // 'casemap' EXTERN char *p_cmp; // 'casemap'
EXTERN unsigned cmp_flags; EXTERN unsigned cmp_flags;
#define CMP_INTERNAL 0x001 #define CMP_INTERNAL 0x001
#define CMP_KEEPASCII 0x002 #define CMP_KEEPASCII 0x002
EXTERN char_u *p_enc; // 'encoding' EXTERN char *p_enc; // 'encoding'
EXTERN int p_deco; // 'delcombine' EXTERN int p_deco; // 'delcombine'
EXTERN char_u *p_ccv; // 'charconvert' EXTERN char *p_ccv; // 'charconvert'
EXTERN char_u *p_cino; ///< 'cinoptions' EXTERN char *p_cino; ///< 'cinoptions'
EXTERN char_u *p_cedit; // 'cedit' EXTERN char *p_cedit; // 'cedit'
EXTERN char_u *p_cb; // 'clipboard' EXTERN char *p_cb; // 'clipboard'
EXTERN unsigned cb_flags; EXTERN unsigned cb_flags;
#define CB_UNNAMED 0x001 #define CB_UNNAMED 0x001
#define CB_UNNAMEDPLUS 0x002 #define CB_UNNAMEDPLUS 0x002
@ -463,33 +463,33 @@ EXTERN char_u *p_cms; ///< 'commentstring'
EXTERN char_u *p_cpt; ///< 'complete' EXTERN char_u *p_cpt; ///< 'complete'
EXTERN long p_columns; // 'columns' EXTERN long p_columns; // 'columns'
EXTERN int p_confirm; // 'confirm' EXTERN int p_confirm; // 'confirm'
EXTERN char_u *p_cot; // 'completeopt' EXTERN char *p_cot; // 'completeopt'
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
EXTERN char_u *p_csl; // 'completeslash' EXTERN char_u *p_csl; // 'completeslash'
#endif #endif
EXTERN long p_pb; // 'pumblend' EXTERN long p_pb; // 'pumblend'
EXTERN long p_ph; // 'pumheight' EXTERN long p_ph; // 'pumheight'
EXTERN long p_pw; // 'pumwidth' EXTERN long p_pw; // 'pumwidth'
EXTERN char_u *p_com; ///< 'comments' EXTERN char *p_com; ///< 'comments'
EXTERN char *p_cpo; // 'cpoptions' EXTERN char *p_cpo; // 'cpoptions'
EXTERN char_u *p_csprg; // 'cscopeprg' EXTERN char *p_csprg; // 'cscopeprg'
EXTERN int p_csre; // 'cscoperelative' EXTERN int p_csre; // 'cscoperelative'
EXTERN char_u *p_csqf; // 'cscopequickfix' EXTERN char *p_csqf; // 'cscopequickfix'
#define CSQF_CMDS "sgdctefia" #define CSQF_CMDS "sgdctefia"
#define CSQF_FLAGS "+-0" #define CSQF_FLAGS "+-0"
EXTERN int p_cst; // 'cscopetag' EXTERN int p_cst; // 'cscopetag'
EXTERN long p_csto; // 'cscopetagorder' EXTERN long p_csto; // 'cscopetagorder'
EXTERN long p_cspc; // 'cscopepathcomp' EXTERN long p_cspc; // 'cscopepathcomp'
EXTERN int p_csverbose; // 'cscopeverbose' EXTERN int p_csverbose; // 'cscopeverbose'
EXTERN char_u *p_debug; // 'debug' EXTERN char *p_debug; // 'debug'
EXTERN char_u *p_def; // 'define' EXTERN char *p_def; // 'define'
EXTERN char_u *p_inc; EXTERN char *p_inc;
EXTERN char_u *p_dip; // 'diffopt' EXTERN char *p_dip; // 'diffopt'
EXTERN char_u *p_dex; // 'diffexpr' EXTERN char *p_dex; // 'diffexpr'
EXTERN char_u *p_dict; // 'dictionary' EXTERN char *p_dict; // 'dictionary'
EXTERN int p_dg; // 'digraph' EXTERN int p_dg; // 'digraph'
EXTERN char_u *p_dir; // 'directory' EXTERN char *p_dir; // 'directory'
EXTERN char_u *p_dy; // 'display' EXTERN char *p_dy; // 'display'
EXTERN unsigned dy_flags; EXTERN unsigned dy_flags;
#define DY_LASTLINE 0x001 #define DY_LASTLINE 0x001
#define DY_TRUNCATE 0x002 #define DY_TRUNCATE 0x002
@ -497,7 +497,7 @@ EXTERN unsigned dy_flags;
// code should use msg_use_msgsep() to check if msgsep is active // code should use msg_use_msgsep() to check if msgsep is active
#define DY_MSGSEP 0x008 #define DY_MSGSEP 0x008
EXTERN int p_ed; // 'edcompatible' EXTERN int p_ed; // 'edcompatible'
EXTERN char_u *p_ead; // 'eadirection' EXTERN char *p_ead; // 'eadirection'
EXTERN int p_emoji; // 'emoji' EXTERN int p_emoji; // 'emoji'
EXTERN int p_ea; // 'equalalways' EXTERN int p_ea; // 'equalalways'
EXTERN char_u *p_ep; // 'equalprg' EXTERN char_u *p_ep; // 'equalprg'
@ -507,20 +507,20 @@ EXTERN char *p_efm; // 'errorformat'
EXTERN char *p_gefm; // 'grepformat' EXTERN char *p_gefm; // 'grepformat'
EXTERN char_u *p_gp; // 'grepprg' EXTERN char_u *p_gp; // 'grepprg'
EXTERN int p_eol; ///< 'endofline' EXTERN int p_eol; ///< 'endofline'
EXTERN char_u *p_ei; // 'eventignore' EXTERN char *p_ei; // 'eventignore'
EXTERN int p_et; ///< 'expandtab' EXTERN int p_et; ///< 'expandtab'
EXTERN int p_exrc; // 'exrc' EXTERN int p_exrc; // 'exrc'
EXTERN char_u *p_fenc; ///< 'fileencoding' EXTERN char *p_fenc; ///< 'fileencoding'
EXTERN char_u *p_fencs; // 'fileencodings' EXTERN char *p_fencs; // 'fileencodings'
EXTERN char_u *p_ff; ///< 'fileformat' EXTERN char *p_ff; ///< 'fileformat'
EXTERN char *p_ffs; // 'fileformats' EXTERN char *p_ffs; // 'fileformats'
EXTERN int p_fic; // 'fileignorecase' EXTERN int p_fic; // 'fileignorecase'
EXTERN char_u *p_ft; ///< 'filetype' EXTERN char *p_ft; ///< 'filetype'
EXTERN char_u *p_fcs; ///< 'fillchar' EXTERN char *p_fcs; ///< 'fillchar'
EXTERN int p_fixeol; ///< 'fixendofline' EXTERN int p_fixeol; ///< 'fixendofline'
EXTERN char_u *p_fcl; // 'foldclose' EXTERN char *p_fcl; // 'foldclose'
EXTERN long p_fdls; // 'foldlevelstart' EXTERN long p_fdls; // 'foldlevelstart'
EXTERN char_u *p_fdo; // 'foldopen' EXTERN char *p_fdo; // 'foldopen'
EXTERN unsigned fdo_flags; EXTERN unsigned fdo_flags;
#define FDO_ALL 0x001 #define FDO_ALL 0x001
#define FDO_BLOCK 0x002 #define FDO_BLOCK 0x002
@ -540,28 +540,28 @@ EXTERN char_u *p_fp; // 'formatprg'
EXTERN int p_fs; // 'fsync' EXTERN int p_fs; // 'fsync'
EXTERN int p_gd; // 'gdefault' EXTERN int p_gd; // 'gdefault'
EXTERN char_u *p_pdev; // 'printdevice' EXTERN char_u *p_pdev; // 'printdevice'
EXTERN char_u *p_penc; // 'printencoding' EXTERN char *p_penc; // 'printencoding'
EXTERN char_u *p_pexpr; // 'printexpr' EXTERN char *p_pexpr; // 'printexpr'
EXTERN char_u *p_pmfn; // 'printmbfont' EXTERN char *p_pmfn; // 'printmbfont'
EXTERN char_u *p_pmcs; // 'printmbcharset' EXTERN char *p_pmcs; // 'printmbcharset'
EXTERN char_u *p_pfn; // 'printfont' EXTERN char *p_pfn; // 'printfont'
EXTERN char_u *p_popt; // 'printoptions' EXTERN char *p_popt; // 'printoptions'
EXTERN char_u *p_header; // 'printheader' EXTERN char_u *p_header; // 'printheader'
EXTERN char_u *p_guicursor; // 'guicursor' EXTERN char *p_guicursor; // 'guicursor'
EXTERN char_u *p_guifont; // 'guifont' EXTERN char_u *p_guifont; // 'guifont'
EXTERN char_u *p_guifontwide; // 'guifontwide' EXTERN char_u *p_guifontwide; // 'guifontwide'
EXTERN char_u *p_hf; // 'helpfile' EXTERN char *p_hf; // 'helpfile'
EXTERN long p_hh; // 'helpheight' EXTERN long p_hh; // 'helpheight'
EXTERN char_u *p_hlg; // 'helplang' EXTERN char_u *p_hlg; // 'helplang'
EXTERN int p_hid; // 'hidden' EXTERN int p_hid; // 'hidden'
EXTERN char_u *p_hl; // 'highlight' EXTERN char *p_hl; // 'highlight'
EXTERN int p_hls; // 'hlsearch' EXTERN int p_hls; // 'hlsearch'
EXTERN long p_hi; // 'history' EXTERN long p_hi; // 'history'
EXTERN int p_hkmap; // 'hkmap' EXTERN int p_hkmap; // 'hkmap'
EXTERN int p_hkmapp; // 'hkmapp' EXTERN int p_hkmapp; // 'hkmapp'
EXTERN int p_arshape; // 'arabicshape' EXTERN int p_arshape; // 'arabicshape'
EXTERN int p_icon; // 'icon' EXTERN int p_icon; // 'icon'
EXTERN char_u *p_iconstring; // 'iconstring' EXTERN char *p_iconstring; // 'iconstring'
EXTERN int p_ic; // 'ignorecase' EXTERN int p_ic; // 'ignorecase'
EXTERN long p_iminsert; ///< 'iminsert' EXTERN long p_iminsert; ///< 'iminsert'
EXTERN long p_imsearch; ///< 'imsearch' EXTERN long p_imsearch; ///< 'imsearch'
@ -570,20 +570,20 @@ EXTERN char_u *p_inex; ///< 'includeexpr'
EXTERN int p_is; // 'incsearch' EXTERN int p_is; // 'incsearch'
EXTERN char_u *p_inde; ///< 'indentexpr' EXTERN char_u *p_inde; ///< 'indentexpr'
EXTERN char_u *p_indk; ///< 'indentkeys' EXTERN char_u *p_indk; ///< 'indentkeys'
EXTERN char_u *p_icm; // 'inccommand' EXTERN char *p_icm; // 'inccommand'
EXTERN char_u *p_isf; // 'isfname' EXTERN char *p_isf; // 'isfname'
EXTERN char_u *p_isi; // 'isident' EXTERN char *p_isi; // 'isident'
EXTERN char_u *p_isk; ///< 'iskeyword' EXTERN char *p_isk; ///< 'iskeyword'
EXTERN char_u *p_isp; // 'isprint' EXTERN char *p_isp; // 'isprint'
EXTERN int p_js; // 'joinspaces' EXTERN int p_js; // 'joinspaces'
EXTERN char_u *p_jop; // 'jumpooptions' EXTERN char *p_jop; // 'jumpooptions'
EXTERN unsigned jop_flags; EXTERN unsigned jop_flags;
#define JOP_STACK 0x01 #define JOP_STACK 0x01
#define JOP_VIEW 0x02 #define JOP_VIEW 0x02
EXTERN char_u *p_keymap; ///< 'keymap' EXTERN char_u *p_keymap; ///< 'keymap'
EXTERN char_u *p_kp; // 'keywordprg' EXTERN char_u *p_kp; // 'keywordprg'
EXTERN char_u *p_km; // 'keymodel' EXTERN char *p_km; // 'keymodel'
EXTERN char_u *p_langmap; // 'langmap' EXTERN char *p_langmap; // 'langmap'
EXTERN int p_lnr; // 'langnoremap' EXTERN int p_lnr; // 'langnoremap'
EXTERN int p_lrm; // 'langremap' EXTERN int p_lrm; // 'langremap'
EXTERN char_u *p_lm; // 'langmenu' EXTERN char_u *p_lm; // 'langmenu'
@ -593,7 +593,7 @@ 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_ls; // 'laststatus'
EXTERN long p_stal; // 'showtabline' EXTERN long p_stal; // 'showtabline'
EXTERN char_u *p_lcs; // 'listchars' EXTERN char *p_lcs; // 'listchars'
EXTERN int p_lz; // 'lazyredraw' EXTERN int p_lz; // 'lazyredraw'
EXTERN int p_lpl; // 'loadplugins' EXTERN int p_lpl; // 'loadplugins'
@ -610,34 +610,34 @@ EXTERN long p_mfd; // 'maxfuncdepth'
EXTERN long p_mmd; // 'maxmapdepth' EXTERN long p_mmd; // 'maxmapdepth'
EXTERN long p_mmp; // 'maxmempattern' EXTERN long p_mmp; // 'maxmempattern'
EXTERN long p_mis; // 'menuitems' EXTERN long p_mis; // 'menuitems'
EXTERN char_u *p_msm; // 'mkspellmem' EXTERN char *p_msm; // 'mkspellmem'
EXTERN int p_ml; ///< 'modeline' EXTERN int p_ml; ///< 'modeline'
EXTERN int p_mle; // 'modelineexpr' EXTERN int p_mle; // 'modelineexpr'
EXTERN long p_mls; // 'modelines' EXTERN long p_mls; // 'modelines'
EXTERN int p_ma; ///< 'modifiable' EXTERN int p_ma; ///< 'modifiable'
EXTERN int p_mod; ///< 'modified' EXTERN int p_mod; ///< 'modified'
EXTERN char_u *p_mouse; // 'mouse' EXTERN char *p_mouse; // 'mouse'
EXTERN char_u *p_mousem; // 'mousemodel' EXTERN char *p_mousem; // 'mousemodel'
EXTERN int p_mousef; // 'mousefocus' EXTERN int p_mousef; // 'mousefocus'
EXTERN char_u *p_mousescroll; // 'mousescroll' EXTERN char *p_mousescroll; // 'mousescroll'
EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT); EXTERN long p_mousescroll_vert INIT(= MOUSESCROLL_VERT_DFLT);
EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT); EXTERN long p_mousescroll_hor INIT(= MOUSESCROLL_HOR_DFLT);
EXTERN long p_mouset; // 'mousetime' EXTERN long p_mouset; // 'mousetime'
EXTERN int p_more; // 'more' EXTERN int p_more; // 'more'
EXTERN char_u *p_nf; ///< 'nrformats' EXTERN char_u *p_nf; ///< 'nrformats'
EXTERN char_u *p_opfunc; // 'operatorfunc' EXTERN char *p_opfunc; // 'operatorfunc'
EXTERN char_u *p_para; // 'paragraphs' EXTERN char_u *p_para; // 'paragraphs'
EXTERN int p_paste; // 'paste' EXTERN int p_paste; // 'paste'
EXTERN char_u *p_pt; // 'pastetoggle' EXTERN char_u *p_pt; // 'pastetoggle'
EXTERN char_u *p_pex; // 'patchexpr' 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_path; // 'path'
EXTERN char_u *p_cdpath; // 'cdpath' EXTERN char_u *p_cdpath; // 'cdpath'
EXTERN int p_pi; ///< 'preserveindent' EXTERN int p_pi; ///< 'preserveindent'
EXTERN long p_pyx; // 'pyxversion' EXTERN long p_pyx; // 'pyxversion'
EXTERN char_u *p_qe; ///< 'quoteescape' EXTERN char_u *p_qe; ///< 'quoteescape'
EXTERN int p_ro; ///< 'readonly' EXTERN int p_ro; ///< 'readonly'
EXTERN char_u *p_rdb; // 'redrawdebug' EXTERN char *p_rdb; // 'redrawdebug'
EXTERN unsigned rdb_flags; EXTERN unsigned rdb_flags;
#define RDB_COMPOSITOR 0x001 #define RDB_COMPOSITOR 0x001
#define RDB_NOTHROTTLE 0x002 #define RDB_NOTHROTTLE 0x002
@ -651,19 +651,19 @@ EXTERN long p_pvh; // 'previewheight'
EXTERN int p_ari; // 'allowrevins' EXTERN int p_ari; // 'allowrevins'
EXTERN int p_ri; // 'revins' EXTERN int p_ri; // 'revins'
EXTERN int p_ru; // 'ruler' EXTERN int p_ru; // 'ruler'
EXTERN char_u *p_ruf; // 'rulerformat' EXTERN char *p_ruf; // 'rulerformat'
EXTERN char_u *p_pp; // 'packpath' EXTERN char *p_pp; // 'packpath'
EXTERN char_u *p_qftf; // 'quickfixtextfunc' EXTERN char *p_qftf; // 'quickfixtextfunc'
EXTERN char_u *p_rtp; // 'runtimepath' EXTERN char *p_rtp; // 'runtimepath'
EXTERN long p_scbk; // 'scrollback' EXTERN long p_scbk; // 'scrollback'
EXTERN long p_sj; // 'scrolljump' EXTERN long p_sj; // 'scrolljump'
EXTERN long p_so; // 'scrolloff' EXTERN long p_so; // 'scrolloff'
EXTERN char *p_sbo; // 'scrollopt' EXTERN char *p_sbo; // 'scrollopt'
EXTERN char_u *p_sections; // 'sections' EXTERN char *p_sections; // 'sections'
EXTERN int p_secure; // 'secure' EXTERN int p_secure; // 'secure'
EXTERN char_u *p_sel; // 'selection' EXTERN char *p_sel; // 'selection'
EXTERN char_u *p_slm; // 'selectmode' EXTERN char *p_slm; // 'selectmode'
EXTERN char_u *p_ssop; // 'sessionoptions' EXTERN char *p_ssop; // 'sessionoptions'
EXTERN unsigned ssop_flags; EXTERN unsigned ssop_flags;
#define SSOP_BUFFERS 0x001 #define SSOP_BUFFERS 0x001
@ -696,12 +696,12 @@ EXTERN int p_stmp; // 'shelltemp'
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
EXTERN int p_ssl; // 'shellslash' EXTERN int p_ssl; // 'shellslash'
#endif #endif
EXTERN char_u *p_stl; // 'statusline' EXTERN char *p_stl; // 'statusline'
EXTERN char *p_wbr; // 'winbar' EXTERN char *p_wbr; // 'winbar'
EXTERN int p_sr; // 'shiftround' EXTERN int p_sr; // 'shiftround'
EXTERN long p_sw; ///< 'shiftwidth' EXTERN long p_sw; ///< 'shiftwidth'
EXTERN char_u *p_shm; // 'shortmess' EXTERN char *p_shm; // 'shortmess'
EXTERN char_u *p_sbr; // 'showbreak' EXTERN char *p_sbr; // 'showbreak'
EXTERN int p_sc; // 'showcmd' EXTERN int p_sc; // 'showcmd'
EXTERN int p_sft; // 'showfulltag' EXTERN int p_sft; // 'showfulltag'
EXTERN int p_sm; // 'showmatch' EXTERN int p_sm; // 'showmatch'
@ -713,12 +713,12 @@ EXTERN int p_si; ///< 'smartindent'
EXTERN int p_sta; // 'smarttab' EXTERN int p_sta; // 'smarttab'
EXTERN long p_sts; ///< 'softtabstop' EXTERN long p_sts; ///< 'softtabstop'
EXTERN int p_sb; // 'splitbelow' EXTERN int p_sb; // 'splitbelow'
EXTERN char_u *p_sua; ///< 'suffixesadd' EXTERN char *p_sua; ///< 'suffixesadd'
EXTERN int p_swf; ///< 'swapfile' EXTERN int p_swf; ///< 'swapfile'
EXTERN long p_smc; ///< 'synmaxcol' EXTERN long p_smc; ///< 'synmaxcol'
EXTERN long p_tpm; // 'tabpagemax' EXTERN long p_tpm; // 'tabpagemax'
EXTERN char_u *p_tal; // 'tabline' EXTERN char *p_tal; // 'tabline'
EXTERN char_u *p_tpf; // 'termpastefilter' EXTERN char *p_tpf; // 'termpastefilter'
EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter' EXTERN unsigned int tpf_flags; ///< flags from 'termpastefilter'
#define TPF_BS 0x001 #define TPF_BS 0x001
#define TPF_HT 0x002 #define TPF_HT 0x002
@ -732,11 +732,11 @@ EXTERN char_u *p_spc; ///< 'spellcapcheck'
EXTERN char_u *p_spf; ///< 'spellfile' EXTERN char_u *p_spf; ///< 'spellfile'
EXTERN char_u *p_spl; ///< 'spelllang' EXTERN char_u *p_spl; ///< 'spelllang'
EXTERN char_u *p_spo; // 'spelloptions' EXTERN char_u *p_spo; // 'spelloptions'
EXTERN char_u *p_sps; // 'spellsuggest' EXTERN char *p_sps; // 'spellsuggest'
EXTERN int p_spr; // 'splitright' EXTERN int p_spr; // 'splitright'
EXTERN int p_sol; // 'startofline' EXTERN int p_sol; // 'startofline'
EXTERN char_u *p_su; // 'suffixes' EXTERN char_u *p_su; // 'suffixes'
EXTERN char_u *p_swb; // 'switchbuf' EXTERN char *p_swb; // 'switchbuf'
EXTERN unsigned swb_flags; EXTERN unsigned swb_flags;
// Keep in sync with p_swb_values in optionstr.c // Keep in sync with p_swb_values in optionstr.c
#define SWB_USEOPEN 0x001 #define SWB_USEOPEN 0x001
@ -748,7 +748,7 @@ EXTERN unsigned swb_flags;
EXTERN char_u *p_syn; ///< 'syntax' EXTERN char_u *p_syn; ///< 'syntax'
EXTERN long p_ts; ///< 'tabstop' EXTERN long p_ts; ///< 'tabstop'
EXTERN int p_tbs; ///< 'tagbsearch' EXTERN int p_tbs; ///< 'tagbsearch'
EXTERN char_u *p_tc; ///< 'tagcase' EXTERN char *p_tc; ///< 'tagcase'
EXTERN unsigned tc_flags; ///< flags from 'tagcase' EXTERN unsigned tc_flags; ///< flags from 'tagcase'
#define TC_FOLLOWIC 0x01 #define TC_FOLLOWIC 0x01
#define TC_IGNORE 0x02 #define TC_IGNORE 0x02
@ -767,7 +767,7 @@ EXTERN long p_tm; ///< 'timeoutlen'
EXTERN int p_title; ///< 'title' EXTERN int p_title; ///< 'title'
EXTERN long p_titlelen; ///< 'titlelen' EXTERN long p_titlelen; ///< 'titlelen'
EXTERN char_u *p_titleold; ///< 'titleold' EXTERN char_u *p_titleold; ///< 'titleold'
EXTERN char_u *p_titlestring; ///< 'titlestring' EXTERN char *p_titlestring; ///< 'titlestring'
EXTERN char_u *p_tsr; ///< 'thesaurus' EXTERN char_u *p_tsr; ///< 'thesaurus'
EXTERN int p_tgc; ///< 'termguicolors' EXTERN int p_tgc; ///< 'termguicolors'
EXTERN int p_ttimeout; ///< 'ttimeout' EXTERN int p_ttimeout; ///< 'ttimeout'
@ -778,12 +778,12 @@ EXTERN long p_ul; ///< 'undolevels'
EXTERN long p_ur; ///< 'undoreload' EXTERN long p_ur; ///< 'undoreload'
EXTERN long p_uc; ///< 'updatecount' EXTERN long p_uc; ///< 'updatecount'
EXTERN long p_ut; ///< 'updatetime' EXTERN long p_ut; ///< 'updatetime'
EXTERN char_u *p_shada; ///< 'shada' EXTERN char *p_shada; ///< 'shada'
EXTERN char *p_shadafile; ///< 'shadafile' EXTERN char *p_shadafile; ///< 'shadafile'
EXTERN char_u *p_vsts; ///< 'varsofttabstop' EXTERN char_u *p_vsts; ///< 'varsofttabstop'
EXTERN char_u *p_vts; ///< 'vartabstop' EXTERN char_u *p_vts; ///< 'vartabstop'
EXTERN char_u *p_vdir; ///< 'viewdir' 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 unsigned vop_flags; ///< uses SSOP_ flags
EXTERN int p_vb; ///< 'visualbell' EXTERN int p_vb; ///< 'visualbell'
EXTERN char_u *p_ve; ///< 'virtualedit' 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' extern char_u *p_vfile; // 'verbosefile'
#endif #endif
EXTERN int p_warn; // 'warn' EXTERN int p_warn; // 'warn'
EXTERN char_u *p_wop; // 'wildoptions' EXTERN char *p_wop; // 'wildoptions'
EXTERN unsigned wop_flags; EXTERN unsigned wop_flags;
#define WOP_TAGFILE 0x01 #define WOP_TAGFILE 0x01
#define WOP_PUM 0x02 #define WOP_PUM 0x02
EXTERN long p_window; // 'window' EXTERN long p_window; // 'window'
EXTERN char_u *p_wak; // 'winaltkeys' EXTERN char *p_wak; // 'winaltkeys'
EXTERN char_u *p_wig; // 'wildignore' EXTERN char *p_wig; // 'wildignore'
EXTERN char_u *p_ww; // 'whichwrap' EXTERN char *p_ww; // 'whichwrap'
EXTERN long p_wc; // 'wildchar' EXTERN long p_wc; // 'wildchar'
EXTERN long p_wcm; // 'wildcharm' EXTERN long p_wcm; // 'wildcharm'
EXTERN int p_wic; // 'wildignorecase' EXTERN int p_wic; // 'wildignorecase'
EXTERN char_u *p_wim; // 'wildmode' EXTERN char *p_wim; // 'wildmode'
EXTERN int p_wmnu; // 'wildmenu' EXTERN int p_wmnu; // 'wildmenu'
EXTERN long p_wh; // 'winheight' EXTERN long p_wh; // 'winheight'
EXTERN long p_wmh; // 'winminheight' EXTERN long p_wmh; // 'winminheight'

View File

@ -122,21 +122,21 @@ static char_u SHM_ALL[] = { SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_L
/// option values. /// option values.
void didset_string_options(void) void didset_string_options(void)
{ {
(void)opt_strings_flags(p_cmp, p_cmp_values, &cmp_flags, true); (void)opt_strings_flags((char_u *)p_cmp, p_cmp_values, &cmp_flags, true);
(void)opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, true); (void)opt_strings_flags((char_u *)p_bkc, p_bkc_values, &bkc_flags, true);
(void)opt_strings_flags(p_bo, p_bo_values, &bo_flags, true); (void)opt_strings_flags((char_u *)p_bo, p_bo_values, &bo_flags, true);
(void)opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true); (void)opt_strings_flags((char_u *)p_ssop, p_ssop_values, &ssop_flags, true);
(void)opt_strings_flags(p_vop, p_ssop_values, &vop_flags, true); (void)opt_strings_flags((char_u *)p_vop, p_ssop_values, &vop_flags, true);
(void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true); (void)opt_strings_flags((char_u *)p_fdo, p_fdo_values, &fdo_flags, true);
(void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, true); (void)opt_strings_flags((char_u *)p_dy, p_dy_values, &dy_flags, true);
(void)opt_strings_flags(p_rdb, p_rdb_values, &rdb_flags, true); (void)opt_strings_flags((char_u *)p_rdb, p_rdb_values, &rdb_flags, true);
(void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, false); (void)opt_strings_flags((char_u *)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_tpf, p_tpf_values, &tpf_flags, true);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_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((char_u *)p_swb, p_swb_values, &swb_flags, true);
(void)opt_strings_flags(p_wop, p_wop_values, &wop_flags, true); (void)opt_strings_flags((char_u *)p_wop, p_wop_values, &wop_flags, true);
(void)opt_strings_flags(p_jop, p_jop_values, &jop_flags, true); (void)opt_strings_flags((char_u *)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_cb, p_cb_values, &cb_flags, true);
} }
/// Trigger the OptionSet autocommand. /// Trigger the OptionSet autocommand.
@ -281,19 +281,19 @@ void check_string_option(char **pp)
/// ///
/// @param opt_idx option index /// @param opt_idx option index
/// @param varp pointer to option variable /// @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 // the global value is always allocated
if (is_window_local_option(opt_idx)) { if (is_window_local_option(opt_idx)) {
p = (char_u **)GLOBAL_WO(varp); p = (char **)GLOBAL_WO(varp);
} else { } else {
p = (char_u **)get_option_var(opt_idx); p = (char **)get_option_var(opt_idx);
} }
if (!is_global_option(opt_idx) && p != varp) { if (!is_global_option(opt_idx) && p != varp) {
s = vim_strsave(*varp); char *s = xstrdup(*varp);
free_string_option((char *)(*p)); free_string_option(*p);
*p = s; *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. // For buffer/window local option may also set the global value.
if (both) { if (both) {
set_string_option_global(idx, (char_u **)varp); set_string_option_global(idx, varp);
} }
set_option_flag(idx, P_ALLOCED); 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); char *const saved_newval = xstrdup(s);
int value_checked = false; 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, NULL, 0,
opt_flags, &value_checked); opt_flags, &value_checked);
if (errmsg == NULL) { 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 /// @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 /// @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, char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf, size_t errbuflen,
size_t errbuflen, int opt_flags, int *value_checked) int opt_flags, int *value_checked)
{ {
char *errmsg = NULL; char *errmsg = NULL;
char *s, *p; 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)) { && (get_option_flags(opt_idx) & P_SECURE)) {
errmsg = e_secure; errmsg = e_secure;
} else if (((get_option_flags(opt_idx) & P_NFNAME) } else if (((get_option_flags(opt_idx) & P_NFNAME)
&& strpbrk((char *)(*varp), && strpbrk(*varp, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
(secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL)
|| ((get_option_flags(opt_idx) & P_NDNAME) || ((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 // Check for a "normal" directory or file name in some options. Disallow a
// path separator (slash and/or backslash), wildcards and characters that // path separator (slash and/or backslash), wildcards and characters that
// are often illegal in a file name. Be more permissive if "secure" is off. // are often illegal in a file name. Be more permissive if "secure" is off.
errmsg = e_invarg; errmsg = e_invarg;
} else if (gvarp == &p_bkc) { // 'backupcopy' } else if (gvarp == (char_u **)&p_bkc) { // 'backupcopy'
char_u *bkc = p_bkc; char *bkc = p_bkc;
unsigned int *flags = &bkc_flags; unsigned int *flags = &bkc_flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
bkc = (char_u *)curbuf->b_p_bkc; bkc = curbuf->b_p_bkc;
flags = &curbuf->b_bkc_flags; 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 // make the local value empty: use the global value
*flags = 0; *flags = 0;
} else { } 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; 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_YES) != 0)
+ ((*flags & BKC_NO) != 0) != 1) { + ((*flags & BKC_NO) != 0) != 1) {
// Must have exactly one of "auto", "yes" and "no". // 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; 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) { *p_pm == '.' ? p_pm + 1 : p_pm) == 0) {
errmsg = e_backupext_and_patchmode_are_equal; 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) { if (briopt_check(curwin) == FAIL) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &p_isi } else if (varp == &p_isi
|| varp == (char_u **)&(curbuf->b_p_isk) || varp == &(curbuf->b_p_isk)
|| varp == &p_isp || varp == &p_isp
|| varp == &p_isf) { || varp == &p_isf) {
// 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[] // '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' } else if (varp == &p_rtp || varp == &p_pp) { // 'runtimepath' 'packpath'
runtime_search_path_invalidate(); 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' || 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; 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); errmsg = check_colorcolumn(curwin);
} else if (varp == &p_hlg) { // 'helplang' } else if (varp == (char **)&p_hlg) { // 'helplang'
// Check for "", "ab", "ab,cd", etc. // Check for "", "ab", "ab,cd", etc.
for (s = (char *)p_hlg; *s != NUL; s += 3) { for (s = (char *)p_hlg; *s != NUL; s += 3) {
if (s[1] == NUL || ((s[2] != ',' || s[3] == NUL) && s[2] != NUL)) { 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; errmsg = e_unsupportedoption;
} }
} else if (varp == &p_jop) { // 'jumpoptions' } 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; errmsg = e_invarg;
} }
} else if (gvarp == &p_nf) { // 'nrformats' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_ssop) { // 'sessionoptions' } 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; errmsg = e_invarg;
} }
if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) { if ((ssop_flags & SSOP_CURDIR) && (ssop_flags & SSOP_SESDIR)) {
// Don't allow both "sesdir" and "curdir". // 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; errmsg = e_invarg;
} }
} else if (varp == &p_vop) { // 'viewoptions' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_rdb) { // 'redrawdebug' } 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; 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) { if (check_opt_strings((char_u *)p_sbo, p_scbopt_values, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &p_ambw || (int *)varp == &p_emoji) { // 'ambiwidth' } 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; errmsg = e_invarg;
} else { } else {
errmsg = check_chars_options(); errmsg = check_chars_options();
} }
} else if (varp == &p_bg) { // 'background' } 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'); int dark = (*p_bg == 'd');
init_highlight(false, false); 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 // value, that's not what we want here. Disable the color
// scheme and set the colors again. // scheme and set the colors again.
do_unlet(S_LEN("g:colors_name"), true); do_unlet(S_LEN("g:colors_name"), true);
free_string_option((char *)p_bg); free_string_option(p_bg);
p_bg = vim_strsave((char_u *)(dark ? "dark" : "light")); p_bg = xstrdup((dark ? "dark" : "light"));
check_string_option((char **)&p_bg); check_string_option(&p_bg);
init_highlight(false, false); init_highlight(false, false);
} }
} else { } else {
@ -794,24 +793,24 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &p_wop) { // 'wildoptions' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_wak) { // 'winaltkeys' } else if (varp == &p_wak) { // 'winaltkeys'
if (*p_wak == NUL 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; errmsg = e_invarg;
} }
} else if (varp == &p_ei) { // 'eventignore' } else if (varp == &p_ei) { // 'eventignore'
if (check_ei() == FAIL) { if (check_ei() == FAIL) {
errmsg = e_invarg; 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' // 'encoding', 'fileencoding' and 'makeencoding'
if (gvarp == &p_fenc) { if (gvarp == (char_u **)&p_fenc) {
if (!MODIFIABLE(curbuf) && opt_flags != OPT_GLOBAL) { if (!MODIFIABLE(curbuf) && opt_flags != OPT_GLOBAL) {
errmsg = e_modifiable; errmsg = e_modifiable;
} else if (vim_strchr((char *)(*varp), ',') != NULL) { } else if (vim_strchr(*varp, ',') != NULL) {
// No comma allowed in 'fileencoding'; catches confusing it // No comma allowed in 'fileencoding'; catches confusing it
// with 'fileencodings'. // with 'fileencodings'.
errmsg = e_invarg; 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) { if (errmsg == NULL) {
// canonize the value, so that STRCMP() can be used on it // 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); xfree(*varp);
*varp = (char_u *)p; *varp = p;
if (varp == &p_enc) { if (varp == &p_enc) {
// only encoding=utf-8 allowed // only encoding=utf-8 allowed
if (STRCMP(p_enc, "utf-8") != 0) { 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) { } else if (varp == &p_penc) {
// Canonize printencoding if VIM standard one // Canonize printencoding if VIM standard one
p = (char *)enc_canonize(p_penc); p = (char *)enc_canonize((char_u *)p_penc);
xfree(p_penc); xfree(p_penc);
p_penc = (char_u *)p; p_penc = p;
} else if (varp == (char_u **)&curbuf->b_p_keymap) { } else if (varp == &curbuf->b_p_keymap) {
if (!valid_filetype(*varp)) { if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
int secure_save = secure; 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(); status_redraw_curbuf();
} }
} else if (gvarp == &p_ff) { // 'fileformat' } else if (gvarp == (char_u **)&p_ff) { // 'fileformat'
if (!MODIFIABLE(curbuf) && !(opt_flags & OPT_GLOBAL)) { if (!MODIFIABLE(curbuf) && !(opt_flags & OPT_GLOBAL)) {
errmsg = e_modifiable; 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; errmsg = e_invarg;
} else { } else {
redraw_titles(); 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); 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) { if (check_opt_strings((char_u *)p_ffs, p_ff_values, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (gvarp == &p_mps) { // 'matchpairs' } else if (gvarp == &p_mps) { // 'matchpairs'
for (p = (char *)(*varp); *p != NUL; p++) { for (p = *varp; *p != NUL; p++) {
int x2 = -1; int x2 = -1;
int x3 = -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; break;
} }
} }
} else if (gvarp == &p_com) { // 'comments' } else if (gvarp == (char_u **)&p_com) { // 'comments'
for (s = (char *)(*varp); *s;) { for (s = *varp; *s;) {
while (*s && *s != ':') { while (*s && *s != ':') {
if (vim_strchr(COM_ALL, *s) == NULL if (vim_strchr(COM_ALL, *s) == NULL
&& !ascii_isdigit(*s) && *s != '-') { && !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' } 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; 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 // 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 (errmsg == NULL) {
// If the current window is set to use the global // If the current window is set to use the global
// 'listchars'/'fillchars' value, clear the window-local value. // '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); redraw_all_later(UPD_NOT_VALID);
} }
} else if (varp == (char_u **)&curwin->w_p_lcs) { // local 'listchars' } else if (varp == &curwin->w_p_lcs) { // local 'listchars'
errmsg = set_chars_option(curwin, varp, true); errmsg = set_chars_option(curwin, (char_u **)varp, true);
} else if (varp == (char_u **)&curwin->w_p_fcs) { // local 'fillchars' } else if (varp == &curwin->w_p_fcs) { // local 'fillchars'
errmsg = set_chars_option(curwin, varp, true); errmsg = set_chars_option(curwin, (char_u **)varp, true);
} else if (varp == &p_cedit) { // 'cedit' } else if (varp == &p_cedit) { // 'cedit'
errmsg = check_cedit(); errmsg = check_cedit();
} else if (varp == &p_vfile) { // 'verbosefile' } else if (varp == (char **)&p_vfile) { // 'verbosefile'
verbose_stop(); verbose_stop();
if (*p_vfile != NUL && verbose_open() == FAIL) { if (*p_vfile != NUL && verbose_open() == FAIL) {
errmsg = e_invarg; 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 // 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. // of the function and the set of P_ALLOCED at the end of the function.
free_oldval = (get_option_flags(opt_idx) & P_ALLOCED); 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 // Check it's a valid character
if (vim_strchr("!\"%'/:<@cfhnrs", *s) == NULL) { if (vim_strchr("!\"%'/:<@cfhnrs", *s) == NULL) {
errmsg = illegal_char(errbuf, errbuflen, *s); 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) { if (*p_shada && errmsg == NULL && get_shada_parameter('\'') < 0) {
errmsg = N_("E528: Must specify a ' value"); errmsg = N_("E528: Must specify a ' value");
} }
} else if (gvarp == &p_sbr) { // 'showbreak' } else if (gvarp == (char_u **)&p_sbr) { // 'showbreak'
for (s = (char *)(*varp); *s;) { for (s = *varp; *s;) {
if (ptr2cells(s) != 1) { if (ptr2cells(s) != 1) {
errmsg = e_showbreak_contains_unprintable_or_wide_character; 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(); errmsg = parse_printmbfont();
} else if (varp == &p_langmap) { // 'langmap' } else if (varp == &p_langmap) { // 'langmap'
langmap_set(); langmap_set();
} else if (varp == &p_breakat) { // 'breakat' } else if (varp == (char **)&p_breakat) { // 'breakat'
fill_breakat_flags(); fill_breakat_flags();
} else if (varp == &p_titlestring || varp == &p_iconstring) { } else if (varp == &p_titlestring || varp == &p_iconstring) {
// 'titlestring' and 'iconstring' // 'titlestring' and 'iconstring'
int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON; int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
// NULL => statusline syntax // 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; stl_syntax |= flagval;
} else { } else {
stl_syntax &= ~flagval; 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(); did_set_title();
} else if (varp == &p_sel) { // 'selection' } else if (varp == &p_sel) { // 'selection'
if (*p_sel == NUL 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; errmsg = e_invarg;
} }
} else if (varp == &p_slm) { // 'selectmode' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_km) { // 'keymodel' } 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; errmsg = e_invarg;
} else { } else {
km_stopsel = (vim_strchr((char *)p_km, 'o') != NULL); km_stopsel = (vim_strchr(p_km, 'o') != NULL);
km_startsel = (vim_strchr((char *)p_km, 'a') != NULL); km_startsel = (vim_strchr(p_km, 'a') != NULL);
} }
} else if (varp == &p_mousem) { // 'mousemodel' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_mousescroll) { // 'mousescroll' } else if (varp == &p_mousescroll) { // 'mousescroll'
errmsg = check_mousescroll((char *)p_mousescroll); errmsg = check_mousescroll(p_mousescroll);
} else if (varp == &p_swb) { // 'switchbuf' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_debug) { // 'debug' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_dy) { // 'display' } 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; errmsg = e_invarg;
} else { } else {
(void)init_chartab(); (void)init_chartab();
msg_grid_validate(); msg_grid_validate();
} }
} else if (varp == &p_ead) { // 'eadirection' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_cb) { // 'clipboard' } 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; errmsg = e_invarg;
} }
} else if (varp == (char_u **)&(curwin->w_s->b_p_spl) // 'spell' } else if (varp == &(curwin->w_s->b_p_spl) // 'spell'
|| varp == (char_u **)&(curwin->w_s->b_p_spf)) { || varp == &(curwin->w_s->b_p_spf)) {
// When 'spelllang' or 'spellfile' is set and there is a window for this // When 'spelllang' or 'spellfile' is set and there is a window for this
// buffer in which 'spell' is set load the wordlists. // 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)) if ((is_spellfile && !valid_spellfile((char_u *)(*varp)))
|| (!is_spellfile && !valid_spelllang(*varp))) { || (!is_spellfile && !valid_spelllang((char_u *)(*varp)))) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
errmsg = did_set_spell_option(is_spellfile); 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. // When 'spellcapcheck' is set compile the regexp program.
errmsg = compile_cap_prog(curwin->w_s); 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) { if (**varp != NUL && STRCMP("camel", *varp) != 0) {
errmsg = e_invarg; 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'); curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
redraw_titles(); 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' // 'statusline', 'winbar', 'tabline' or 'rulerformat'
int wid; int wid;
if (varp == &p_ruf) { // reset ru_wid first if (varp == &p_ruf) { // reset ru_wid first
ru_wid = 0; ru_wid = 0;
} }
s = (char *)(*varp); s = *varp;
if (varp == &p_ruf && *s == '%') { if (varp == &p_ruf && *s == '%') {
// set ru_wid if 'ruf' starts with "%99(" // set ru_wid if 'ruf' starts with "%99("
if (*++s == '-') { // ignore a '-' if (*++s == '-') { // ignore a '-'
s++; s++;
} }
wid = getdigits_int(&s, true, 0); 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; ru_wid = wid;
} else { } else {
errmsg = check_stl_option((char *)p_ruf); errmsg = check_stl_option(p_ruf);
} }
} else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') { } else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') {
// check 'statusline', 'winbar' or 'tabline' only if it doesn't start with "%!" // 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) { } else if (gvarp == &p_cpt) {
// check if it is a valid value for 'complete' -- Acevedo // check if it is a valid value for 'complete' -- Acevedo
for (s = (char *)(*varp); *s;) { for (s = *varp; *s;) {
while (*s == ',' || *s == ' ') { while (*s == ',' || *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' } 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; errmsg = e_invarg;
} else { } else {
completeopt_was_set(); 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; errmsg = e_invarg;
} }
#endif #endif
} else if (varp == (char_u **)&curwin->w_p_scl) { // 'signcolumn' } else if (varp == &curwin->w_p_scl) { // 'signcolumn'
if (check_signcolumn(*varp) != OK) { if (check_signcolumn((char_u *)(*varp)) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
// When changing the 'signcolumn' to or from 'number', recompute the // 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_p_nu || curwin->w_p_rnu)) {
curwin->w_nrwidth_line_count = 0; curwin->w_nrwidth_line_count = 0;
} }
} else if (varp == (char_u **)&curwin->w_p_fdc } else if (varp == &curwin->w_p_fdc
|| varp == (char_u **)&curwin->w_allbuf_opt.wo_fdc) { || varp == &curwin->w_allbuf_opt.wo_fdc) {
// 'foldcolumn' // '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; errmsg = e_invarg;
} }
} else if (varp == &p_pt) { } else if (varp == (char **)&p_pt) {
// 'pastetoggle': translate key codes like in a mapping // 'pastetoggle': translate key codes like in a mapping
if (*p_pt) { if (*p_pt) {
p = NULL; 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) { if (*p_bs > '3' || p_bs[1] != NUL) {
errmsg = e_invarg; 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; errmsg = e_invarg;
} }
} else if (varp == &p_bo) { } 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; errmsg = e_invarg;
} }
} else if (gvarp == &p_tc) { // 'tagcase' } else if (gvarp == (char_u **)&p_tc) { // 'tagcase'
unsigned int *flags; unsigned int *flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
p = curbuf->b_p_tc; p = curbuf->b_p_tc;
flags = &curbuf->b_tc_flags; flags = &curbuf->b_tc_flags;
} else { } else {
p = (char *)p_tc; p = p_tc;
flags = &tc_flags; 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; errmsg = e_invarg;
} }
} else if (varp == &p_cmp) { // 'casemap' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_dip) { // 'diffopt' } 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; errmsg = e_invarg;
} }
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdm) { // 'foldmethod' } 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) { || *curwin->w_p_fdm == NUL) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
@ -1312,29 +1313,29 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
newFoldLevel(); newFoldLevel();
} }
} }
} else if (varp == (char_u **)&curwin->w_p_fde) { // 'foldexpr' } else if (varp == &curwin->w_p_fde) { // 'foldexpr'
if (foldmethodIsExpr(curwin)) { if (foldmethodIsExpr(curwin)) {
foldUpdateAll(curwin); foldUpdateAll(curwin);
} }
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker' } else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker'
p = vim_strchr((char *)(*varp), ','); p = vim_strchr(*varp, ',');
if (p == NULL) { if (p == NULL) {
errmsg = N_("E536: comma required"); errmsg = N_("E536: comma required");
} else if ((char_u *)p == *varp || p[1] == NUL) { } else if (p == *varp || p[1] == NUL) {
errmsg = e_invarg; errmsg = e_invarg;
} else if (foldmethodIsMarker(curwin)) { } else if (foldmethodIsMarker(curwin)) {
foldUpdateAll(curwin); foldUpdateAll(curwin);
} }
} else if (gvarp == &p_cms) { // 'commentstring' } 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"); errmsg = N_("E537: 'commentstring' must be empty or contain %s");
} }
} else if (varp == &p_fdo) { // 'foldopen' } 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; errmsg = e_invarg;
} }
} else if (varp == &p_fcl) { // 'foldclose' } 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; errmsg = e_invarg;
} }
} else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdi) { // 'foldignore' } 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) { } else if (varp == &p_csqf) {
if (p_csqf != NULL) { if (p_csqf != NULL) {
p = (char *)p_csqf; p = p_csqf;
while (*p != NUL) { while (*p != NUL) {
if (vim_strchr(CSQF_CMDS, *p) == NULL if (vim_strchr(CSQF_CMDS, *p) == NULL
|| p[1] == NUL || 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 // TODO(vim): recognize errors
parse_cino(curbuf); parse_cino(curbuf);
} else if (varp == &p_icm) { // 'inccommand' } 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; errmsg = e_invarg;
} }
} else if (gvarp == &p_ft) { } else if (gvarp == (char_u **)&p_ft) {
if (!valid_filetype(*varp)) { if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
value_changed = STRCMP(oldval, *varp) != 0; 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; *value_checked = true;
} }
} else if (gvarp == &p_syn) { } else if (gvarp == &p_syn) {
if (!valid_filetype(*varp)) { if (!valid_filetype((char_u *)(*varp))) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
value_changed = STRCMP(oldval, *varp) != 0; 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. // even when the value comes from a modeline.
*value_checked = true; *value_checked = true;
} }
} else if (varp == (char_u **)&curwin->w_p_winhl) { } else if (varp == &curwin->w_p_winhl) {
if (!parse_winhl_opt(curwin)) { if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &p_tpf) { } 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; errmsg = e_invarg;
} }
} else if (varp == (char_u **)&(curbuf->b_p_vsts)) { // 'varsofttabstop' } else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
char_u *cp; char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) { if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vsts_array); XFREE_CLEAR(curbuf->b_p_vsts_array);
} else { } else {
for (cp = *varp; *cp; cp++) { for (cp = (char_u *)(*varp); *cp; cp++) {
if (ascii_isdigit(*cp)) { if (ascii_isdigit(*cp)) {
continue; continue;
} }
if (*cp == ',' && cp > *varp && *(cp - 1) != ',') { if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
continue; continue;
} }
errmsg = e_invarg; 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) { if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vsts_array; 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); xfree(oldarray);
} else { } else {
errmsg = e_invarg; errmsg = e_invarg;
} }
} }
} }
} else if (varp == (char_u **)&(curbuf->b_p_vts)) { // 'vartabstop' } else if (varp == &(curbuf->b_p_vts)) { // 'vartabstop'
char_u *cp; char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) { if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(curbuf->b_p_vts_array); XFREE_CLEAR(curbuf->b_p_vts_array);
} else { } else {
for (cp = *varp; *cp; cp++) { for (cp = (char_u *)(*varp); *cp; cp++) {
if (ascii_isdigit(*cp)) { if (ascii_isdigit(*cp)) {
continue; continue;
} }
if (*cp == ',' && cp > *varp && *(cp - 1) != ',') { if (*cp == ',' && cp > (char_u *)(*varp) && *(cp - 1) != ',') {
continue; continue;
} }
errmsg = e_invarg; 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) { if (errmsg == NULL) {
long *oldarray = curbuf->b_p_vts_array; 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); xfree(oldarray);
if (foldmethodIsIndent(curwin)) { if (foldmethodIsIndent(curwin)) {
foldUpdateAll(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' if (varp == &p_shm) { // 'shortmess'
p = (char *)SHM_ALL; p = (char *)SHM_ALL;
} else if (varp == (char_u **)&(p_cpo)) { // 'cpoptions' } else if (varp == &(p_cpo)) { // 'cpoptions'
p = CPO_VI; p = CPO_VI;
} else if (varp == (char_u **)&(curbuf->b_p_fo)) { // 'formatoptions' } else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
p = FO_ALL; p = FO_ALL;
} else if (varp == (char_u **)&curwin->w_p_cocu) { // 'concealcursor' } else if (varp == &curwin->w_p_cocu) { // 'concealcursor'
p = COCU_ALL; p = COCU_ALL;
} else if (varp == &p_mouse) { // 'mouse' } else if (varp == &p_mouse) { // 'mouse'
p = MOUSE_ALL; p = MOUSE_ALL;
} }
if (p != NULL) { if (p != NULL) {
for (s = (char *)(*varp); *s; s++) { for (s = *varp; *s; s++) {
if (vim_strchr(p, *s) == NULL) { if (vim_strchr(p, *s) == NULL) {
errmsg = illegal_char(errbuf, errbuflen, *s); errmsg = illegal_char(errbuf, errbuflen, *s);
break; 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 error detected, restore the previous value.
if (errmsg != NULL) { if (errmsg != NULL) {
free_string_option((char *)(*varp)); free_string_option(*varp);
*varp = oldval; *varp = oldval;
// When resetting some values, need to act on it. // When resetting some values, need to act on it.
if (did_chartab) { 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 // Use "free_oldval", because recursiveness may change the flags under
// our fingers (esp. init_highlight()). // our fingers (esp. init_highlight()).
if (free_oldval) { if (free_oldval) {
free_string_option((char *)oldval); free_string_option(oldval);
} }
set_option_flag(opt_idx, P_ALLOCED); 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. // Trigger the autocommand only after setting the flags.
// When 'syntax' is set, load the syntax of that name // 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; static int syn_recursive = 0;
syn_recursive++; 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); value_changed || syn_recursive == 1, curbuf);
curbuf->b_flags |= BF_SYN_SET; curbuf->b_flags |= BF_SYN_SET;
syn_recursive--; 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 // 'filetype' is set, trigger the FileType autocommand
// Skip this when called from a modeline and the filetype was // Skip this when called from a modeline and the filetype was
// already set to this value. // 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); value_changed || ft_recursive == 1, curbuf);
ft_recursive--; ft_recursive--;
// Just in case the old "curbuf" is now invalid // 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; varp = NULL;
} }
secure = secure_save; 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 fname[200];
char_u *q = (char_u *)curwin->w_s->b_p_spl; char_u *q = (char_u *)curwin->w_s->b_p_spl;

View File

@ -937,8 +937,8 @@ char *vim_getenv(const char *name)
// - the directory name from 'helpfile' (unless it contains '$') // - the directory name from 'helpfile' (unless it contains '$')
// - the executable name from argv[0] // - the executable name from argv[0]
if (vim_path == NULL) { if (vim_path == NULL) {
if (p_hf != NULL && vim_strchr((char *)p_hf, '$') == NULL) { if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL) {
vim_path = (char *)p_hf; vim_path = p_hf;
} }
char exe_name[MAXPATHL]; char exe_name[MAXPATHL];
@ -957,7 +957,7 @@ char *vim_getenv(const char *name)
char *vim_path_end = path_tail(vim_path); char *vim_path_end = path_tail(vim_path);
// remove "doc/" from 'helpfile', if present // 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"); vim_path_end = remove_tail(vim_path, vim_path_end, "doc");
} }

View File

@ -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); ffname = (char_u *)FullName_save((*files)[i], false);
assert((*files)[i] != NULL); assert((*files)[i] != NULL);
assert(ffname != 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 // remove this matching file from the list
xfree((*files)[i]); xfree((*files)[i]);
for (j = i; j + 1 < *num_files; j++) { for (j = i; j + 1 < *num_files; j++) {

View File

@ -703,7 +703,7 @@ static bool pum_set_selected(int n, int repeat)
if ((pum_array[pum_selected].pum_info != NULL) if ((pum_array[pum_selected].pum_info != NULL)
&& (Rows > 10) && (Rows > 10)
&& (repeat <= 1) && (repeat <= 1)
&& (vim_strchr((char *)p_cot, 'p') != NULL)) { && (vim_strchr(p_cot, 'p') != NULL)) {
win_T *curwin_save = curwin; win_T *curwin_save = curwin;
tabpage_T *curtab_save = curtab; tabpage_T *curtab_save = curtab;
int res = OK; int res = OK;

View File

@ -1000,7 +1000,7 @@ static int qf_setup_state(qfstate_T *pstate, char *restrict enc, const char *res
{ {
pstate->vc.vc_type = CONV_NONE; pstate->vc.vc_type = CONV_NONE;
if (enc != NULL && *enc != NUL) { 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 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) { if (win_split(0, flags) == FAIL) {
return FAIL; // not enough room for window 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; swb_flags = 0;
RESET_BINDING(curwin); RESET_BINDING(curwin);
if (ll_ref != NULL) { 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. // 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) 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; unsigned old_swb_flags = swb_flags;
const bool old_KeyTyped = KeyTyped; // getting file may reset it const bool old_KeyTyped = KeyTyped; // getting file may reset it
@ -2994,10 +2994,10 @@ theend:
qfl->qf_ptr = qf_ptr; qfl->qf_ptr = qf_ptr;
qfl->qf_index = qf_index; 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 // Restore old 'switchbuf' value, but not when an autocommand or
// modeline has changed the value. // modeline has changed the value.
p_swb = (char_u *)old_swb; p_swb = old_swb;
swb_flags = old_swb_flags; swb_flags = old_swb_flags;
} }
decr_quickfix_busy(); decr_quickfix_busy();
@ -3834,7 +3834,7 @@ static buf_T *qf_find_buf(qf_info_T *qi)
/// @return OK or FAIL /// @return OK or FAIL
int qf_process_qftf_option(void) 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 /// 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) FUNC_ATTR_NONNULL_ARG(1, 2)
{ {
// Go through all directories in 'runtimepath' // Go through all directories in 'runtimepath'
char *p = (char *)p_rtp; char *p = p_rtp;
while (*p != NUL && !got_int) { while (*p != NUL && !got_int) {
copy_option_part(&p, (char *)NameBuff, MAXPATHL, ","); copy_option_part(&p, (char *)NameBuff, MAXPATHL, ",");

View File

@ -303,7 +303,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
xfree(buf); xfree(buf);
xfree(rtp_copy); xfree(rtp_copy);
if (!did_one && name != NULL) { 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) { if (flags & DIP_ERR) {
semsg(_(e_dirnotf), basepath, name); 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/" : ""; char *suffix = (flags & DIP_AFTER) ? "after/" : "";
vim_snprintf(s, len, start_dir, suffix, name); 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); 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); s = xmallocz(len);
vim_snprintf(s, len, start_dir, suffix, name); 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); 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); char *s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name); 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); 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); s = xmallocz(len);
vim_snprintf(s, len, opt_dir, name); 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); xfree(s);
} }
@ -665,7 +665,7 @@ RuntimeSearchPath runtime_search_path_build(void)
CharVec after_path = KV_INITIAL_VALUE; CharVec after_path = KV_INITIAL_VALUE;
static char_u buf[MAXPATHL]; static char_u buf[MAXPATHL];
for (char *entry = (char *)p_pp; *entry != NUL;) { for (char *entry = p_pp; *entry != NUL;) {
char *cur_entry = entry; char *cur_entry = entry;
copy_option_part(&entry, (char *)buf, MAXPATHL, ","); copy_option_part(&entry, (char *)buf, MAXPATHL, ",");
@ -676,7 +676,7 @@ RuntimeSearchPath runtime_search_path_build(void)
} }
char *rtp_entry; 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; char *cur_entry = rtp_entry;
copy_option_part(&rtp_entry, (char *)buf, MAXPATHL, ","); copy_option_part(&rtp_entry, (char *)buf, MAXPATHL, ",");
size_t buflen = STRLEN(buf); 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 // TODO(bfredl): we could integrate disabled OPT dirs into the cached path
// which would effectivize ":packadd myoptpack" as well // which would effectivize ":packadd myoptpack" as well
if ((flags & (DIP_START|DIP_OPT)) && (success == FAIL || (flags & DIP_ALL))) { 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; 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'. /// Add all packages in the "start" directory to 'runtimepath'.
void add_pack_start_dirs(void) 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) 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) void load_start_packages(void)
{ {
did_source_packages = true; 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); 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); add_start_pack_plugin, &APP_LOAD);
} }
@ -1093,12 +1093,12 @@ void ex_packloadall(exarg_T *eap)
void load_plugins(void) void load_plugins(void)
{ {
if (p_lpl) { 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_vim = (char_u *)"plugin/**/*.vim"; // NOLINT
char_u *const plugin_pattern_lua = (char_u *)"plugin/**/*.lua"; // NOLINT char_u *const plugin_pattern_lua = (char_u *)"plugin/**/*.lua"; // NOLINT
if (!did_source_packages) { if (!did_source_packages) {
rtp_copy = vim_strsave(p_rtp); rtp_copy = vim_strsave((char_u *)p_rtp);
add_pack_start_dirs(); add_pack_start_dirs();
} }
@ -1139,7 +1139,8 @@ void ex_packadd(exarg_T *eap)
vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg); 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 // The first round don't give a "not found" error, in the second round
// only when nothing was found in the first 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), 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, round == 1 ? add_start_pack_plugin : add_opt_pack_plugin,
eap->forceit ? &APP_ADD_DIR : &APP_BOTH); eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
xfree(pat); 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; size_t size = STRLEN(dirnames[i]) + pat_len + 7;
char_u *s = xmalloc(size); char_u *s = xmalloc(size);
snprintf((char *)s, size, "%s/%s*.vim", dirnames[i], pat); 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) { if (flags & DIP_LUA) {
snprintf((char *)s, size, "%s/%s*.lua", dirnames[i], pat); 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); 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; size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size); char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT 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) { if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT 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); 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; size_t size = STRLEN(dirnames[i]) + pat_len + 22;
char_u *s = xmalloc(size); char_u *s = xmalloc(size);
snprintf((char *)s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT 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) { if (flags & DIP_LUA) {
snprintf((char *)s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT 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); 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; size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size); char_u *s = xmalloc(size);
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT 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) { if (flags & DIP_LUA) {
snprintf((char *)s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT 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); 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; size_t size = STRLEN(dirnames[i]) + pat_len + 20;
char_u *s = xmalloc(size); char_u *s = xmalloc(size);
snprintf((char *)s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT 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) { if (flags & DIP_LUA) {
snprintf((char *)s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT 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); xfree(s);
} }
@ -1276,9 +1277,9 @@ int ExpandPackAddDir(char_u *pat, int *num_file, char ***file)
size_t buflen = pat_len + 26; size_t buflen = pat_len + 26;
char_u *s = xmalloc(buflen); char_u *s = xmalloc(buflen);
snprintf((char *)s, buflen, "pack/*/opt/%s*", pat); // NOLINT 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 snprintf((char *)s, buflen, "opt/%s*", pat); // NOLINT
globpath((char *)p_pp, s, &ga, 0); globpath(p_pp, s, &ga, 0);
xfree(s); xfree(s);
for (int i = 0; i < ga.ga_len; i++) { 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 if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
&& firstline[1] == 0xbb && firstline[2] == 0xbf) { && firstline[1] == 0xbb && firstline[2] == 0xbf) {
// Found BOM; setup conversion, skip over BOM and recode the line. // 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); p = (char *)string_convert(&cookie.conv, (char_u *)firstline + 3, NULL);
if (p == NULL) { if (p == NULL) {
p = xstrdup((char *)firstline + 3); p = xstrdup((char *)firstline + 3);
@ -2438,7 +2439,7 @@ void ex_scriptencoding(exarg_T *eap)
// Setup for conversion from the specified encoding to 'encoding'. // Setup for conversion from the specified encoding to 'encoding'.
sp = (struct source_cookie *)getline_cookie(eap->getline, eap->cookie); 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) { if (name != eap->arg) {
xfree(name); xfree(name);

View File

@ -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:" const char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
int multispace_len = 0; // Length of lcs-multispace string int multispace_len = 0; // Length of lcs-multispace string
int lead_multispace_len = 0; // Length of lcs-leadmultispace 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 { struct chars_tab {
int *cp; ///< char value int *cp; ///< char value
@ -1349,13 +1349,13 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
tab = lcs_tab; tab = lcs_tab;
entries = ARRAY_SIZE(lcs_tab); entries = ARRAY_SIZE(lcs_tab);
if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) { 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 { } else {
tab = fcs_tab; tab = fcs_tab;
entries = ARRAY_SIZE(fcs_tab); entries = ARRAY_SIZE(fcs_tab);
if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) { 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. /// @return an untranslated error message if any of them is invalid, NULL otherwise.
char *check_chars_options(void) 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; 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; return e_conflicts_with_value_of_fillchars;
} }
FOR_ALL_TAB_WINDOWS(tp, wp) { FOR_ALL_TAB_WINDOWS(tp, wp) {

View File

@ -2683,7 +2683,7 @@ int startPS(linenr_T lnum, int para, int both)
if (*s == para || *s == '\f' || (both && *s == '}')) { if (*s == para || *s == '\f' || (both && *s == '}')) {
return true; return true;
} }
if (*s == '.' && (inmacro(p_sections, s + 1) if (*s == '.' && (inmacro((char_u *)p_sections, s + 1)
|| (!para && inmacro(p_para, s + 1)))) { || (!para && inmacro(p_para, s + 1)))) {
return true; 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; 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) { if (*inc_opt != NUL) {
incl_regmatch.regprog = vim_regcomp((char *)inc_opt, p_magic ? RE_MAGIC : 0); incl_regmatch.regprog = vim_regcomp((char *)inc_opt, p_magic ? RE_MAGIC : 0);
if (incl_regmatch.regprog == NULL) { 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)) { if (type == FIND_DEFINE && (*curbuf->b_p_def != NUL || *p_def != NUL)) {
def_regmatch.regprog = vim_regcomp(*curbuf->b_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); p_magic ? RE_MAGIC : 0);
if (def_regmatch.regprog == NULL) { if (def_regmatch.regprog == NULL) {
goto fpip_end; goto fpip_end;

View File

@ -3996,7 +3996,7 @@ static bool shada_removable(const char *name)
bool retval = false; bool retval = false;
char *new_name = home_replace_save(NULL, (char *)name); 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), ", "); (void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
if (part[0] == 'r') { if (part[0] == 'r') {
home_replace(NULL, part + 1, (char *)NameBuff, MAXPATHL, true); home_replace(NULL, part + 1, (char *)NameBuff, MAXPATHL, true);

View File

@ -1518,7 +1518,7 @@ static void spell_load_lang(char_u *lang)
char_u *spell_enc(void) char_u *spell_enc(void)
{ {
if (STRLEN(p_enc) < 60 && STRCMP(p_enc, "iso-8859-15") != 0) { if (STRLEN(p_enc) < 60 && STRCMP(p_enc, "iso-8859-15") != 0) {
return p_enc; return (char_u *)p_enc;
} }
return (char_u *)"latin1"; return (char_u *)"latin1";
} }

View File

@ -1863,7 +1863,7 @@ static long compress_added = 500000; // word count
// Sets "sps_flags". // Sets "sps_flags".
int spell_check_msm(void) int spell_check_msm(void)
{ {
char *p = (char *)p_msm; char *p = p_msm;
long start = 0; long start = 0;
long incr = 0; long incr = 0;
long added = 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'. // Setup for conversion from "ENC" to 'encoding'.
aff->af_enc = enc_canonize(items[1]); aff->af_enc = enc_canonize(items[1]);
if (!spin->si_ascii if (!spin->si_ascii
&& convert_setup(&spin->si_conv, aff->af_enc, && convert_setup(&spin->si_conv, aff->af_enc, (char_u *)p_enc) == FAIL) {
p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"), smsg(_("Conversion in %s not supported: from %s to %s"),
fname, aff->af_enc, p_enc); fname, aff->af_enc, p_enc);
} }
@ -3731,8 +3730,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
line += 9; line += 9;
enc = enc_canonize(line); enc = enc_canonize(line);
if (!spin->si_ascii if (!spin->si_ascii
&& convert_setup(&spin->si_conv, enc, && convert_setup(&spin->si_conv, enc, (char_u *)p_enc) == FAIL) {
p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"), smsg(_("Conversion in %s not supported: from %s to %s"),
fname, line, p_enc); 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 // Loop over all entries in 'runtimepath'. Use the first one where we
// are allowed to write. // are allowed to write.
rtp = p_rtp; rtp = (char_u *)p_rtp;
while (*rtp != NUL) { while (*rtp != NUL) {
if (aspath) { if (aspath) {
// Use directory of an entry with path, e.g., for // Use directory of an entry with path, e.g., for

View File

@ -360,7 +360,7 @@ int spell_check_sps(void)
sps_flags = 0; sps_flags = 0;
sps_limit = 9999; sps_limit = 9999;
for (p = (char *)p_sps; *p != NUL;) { for (p = p_sps; *p != NUL;) {
copy_option_part(&p, (char *)buf, MAXPATHL, ","); copy_option_part(&p, (char *)buf, MAXPATHL, ",");
f = 0; 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. // 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'. // Loop over the items in 'spellsuggest'.
for (p = (char *)sps_copy; *p != NUL;) { for (p = (char *)sps_copy; *p != NUL;) {

View File

@ -448,7 +448,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
// setup environment for the task at hand // setup environment for the task at hand
if (wp == NULL) { if (wp == NULL) {
// Use 'tabline'. Always at the first line of the screen. // Use 'tabline'. Always at the first line of the screen.
stl = p_tal; stl = (char_u *)p_tal;
row = 0; row = 0;
fillchar = ' '; fillchar = ' ';
attr = HL_ATTR(HLF_TPF); 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) { if (draw_ruler) {
stl = p_ruf; stl = (char_u *)p_ruf;
// advance past any leading group spec - implicit in ru_col // advance past any leading group spec - implicit in ru_col
if (*stl == '%') { if (*stl == '%') {
if (*++stl == '-') { if (*++stl == '-') {
@ -503,7 +503,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
} }
} }
if (*stl++ != '(') { if (*stl++ != '(') {
stl = p_ruf; stl = (char_u *)p_ruf;
} }
} }
col = ru_col - (Columns - maxwidth); 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) { if (*wp->w_p_stl != NUL) {
stl = (char_u *)wp->w_p_stl; stl = (char_u *)wp->w_p_stl;
} else { } else {
stl = p_stl; stl = (char_u *)p_stl;
} }
use_sandbox = was_set_insecurely(wp, "statusline", *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); use_sandbox = was_set_insecurely(wp, "statusline", *wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
} }

View File

@ -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 a pointer to the first argument.
/// Return NULL if the end of the command was found instead of further args. /// 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); // Check if there are enough arguments. The first argument may be a
rest = (char_u *)skipwhite((char *)(*name_end)); // 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) { if (ends_excmd(*arg) || *rest == NUL) {
return NULL; 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 a pointer to the next argument (which isn't an option).
/// Return NULL for any error; /// 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; char_u *gname_start, *gname;
int syn_id; 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; p = flagtab[fidx].name;
int i; int i;
for (i = 0, len = 0; p[i] != NUL; i += 2, len++) { 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; 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] == '=') { } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
// cchar=? // cchar=?
*conceal_char = utf_ptr2char((char *)arg + 6); *conceal_char = utf_ptr2char(arg + 6);
arg += utfc_ptr2len((char *)arg + 6) - 1; arg += utfc_ptr2len(arg + 6) - 1;
if (!vim_isprintc_strict(*conceal_char)) { if (!vim_isprintc_strict(*conceal_char)) {
emsg(_("E844: invalid cchar value")); emsg(_("E844: invalid cchar value"));
return NULL; return NULL;
} }
arg = (char_u *)skipwhite((char *)arg + 7); arg = skipwhite(arg + 7);
} else { } else {
opt->flags |= flagtab[fidx].flags; opt->flags |= flagtab[fidx].flags;
arg = (char_u *)skipwhite((char *)arg + len); arg = skipwhite(arg + len);
if (flagtab[fidx].flags == HL_SYNC_HERE if (flagtab[fidx].flags == HL_SYNC_HERE
|| flagtab[fidx].flags == HL_SYNC_THERE) { || 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")); emsg(_("E393: group[t]here not accepted here"));
return NULL; return NULL;
} }
gname_start = arg; gname_start = (char_u *)arg;
arg = skiptowhite(arg); arg = (char *)skiptowhite((char_u *)arg);
if (gname_start == arg) { if (gname_start == (char_u *)arg) {
return NULL; 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) { if (STRCMP(gname, "NONE") == 0) {
*opt->sync_idx = NONE_IDX; *opt->sync_idx = NONE_IDX;
} else { } else {
@ -4200,7 +4196,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
} }
xfree(gname); xfree(gname);
arg = (char_u *)skipwhite((char *)arg); arg = skipwhite(arg);
} else if (flagtab[fidx].flags == HL_FOLD } else if (flagtab[fidx].flags == HL_FOLD
&& foldmethodIsSyntax(curwin)) { && foldmethodIsSyntax(curwin)) {
// Need to update folds later. // 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) 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; int sgl_id = 1;
char_u *group_name_end; char *group_name_end;
char_u *rest; char *rest;
char *errormsg = NULL; char *errormsg = NULL;
int prev_toplvl_grp; int prev_toplvl_grp;
int prev_syn_inc_tag; int prev_syn_inc_tag;
bool source = false; bool source = false;
eap->nextcmd = (char *)find_nextcmd(arg); eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
if (eap->skip) { if (eap->skip) {
return; return;
} }
@ -4261,12 +4257,12 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
emsg(_("E397: Filename required")); emsg(_("E397: Filename required"));
return; 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) { if (sgl_id == 0) {
return; return;
} }
// separate_nextcmd() and expand_filename() depend on this // 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) static void syn_cmd_keyword(exarg_T *eap, int syncing)
{ {
char_u *arg = (char_u *)eap->arg; char *arg = eap->arg;
char_u *group_name_end; char *group_name_end;
int syn_id; int syn_id;
char_u *rest; char *rest;
char_u *keyword_copy = NULL; char *keyword_copy = NULL;
char_u *p; char *p;
char_u *kw; char *kw;
syn_opt_arg_T syn_opt_arg; syn_opt_arg_T syn_opt_arg;
int cnt; int cnt;
int conceal_char = NUL; int conceal_char = NUL;
@ -4331,7 +4327,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
if (eap->skip) { if (eap->skip) {
syn_id = -1; syn_id = -1;
} else { } 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) { if (syn_id != 0) {
// Allocate a buffer, for removing backslashes in the keyword. // 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. // 1: collect the options and copy the keywords to keyword_copy.
cnt = 0; cnt = 0;
p = keyword_copy; p = keyword_copy;
for (; rest != NULL && !ends_excmd(*rest); rest = (char_u *)skipwhite((char *)rest)) { for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
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)) { if (rest == NULL || ends_excmd(*rest)) {
break; break;
} }
@ -4372,11 +4368,11 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
// 2: Add an entry for each keyword. // 2: Add an entry for each keyword.
for (kw = keyword_copy; --cnt >= 0; kw += STRLEN(kw) + 1) { 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) { if (p != NULL) {
*p = NUL; *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.cont_in_list,
syn_opt_arg.next_list, conceal_char); syn_opt_arg.next_list, conceal_char);
if (p == NULL) { if (p == NULL) {
@ -4395,7 +4391,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
kw = p + 1; kw = p + 1;
break; // skip over the "]" 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); memmove(p, p + 1, (size_t)l);
p += l; p += l;
@ -4411,7 +4407,7 @@ error:
} }
if (rest != NULL) { if (rest != NULL) {
eap->nextcmd = (char *)check_nextcmd(rest); eap->nextcmd = (char *)check_nextcmd((char_u *)rest);
} else { } else {
semsg(_(e_invarg2), arg); semsg(_(e_invarg2), arg);
} }
@ -4427,9 +4423,8 @@ error:
/// @param syncing true for ":syntax sync match .. " /// @param syncing true for ":syntax sync match .. "
static void syn_cmd_match(exarg_T *eap, int syncing) static void syn_cmd_match(exarg_T *eap, int syncing)
{ {
char_u *arg = (char_u *)eap->arg; char *arg = eap->arg;
char_u *group_name_end; char *group_name_end;
char_u *rest;
synpat_T item; // the item found in the line synpat_T item; // the item found in the line
int syn_id; int syn_id;
syn_opt_arg_T syn_opt_arg; 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; int conceal_char = NUL;
// Isolate the group name, check for validity // 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 // Get options before the pattern
syn_opt_arg.flags = 0; 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_list = NULL;
syn_opt_arg.cont_in_list = NULL; syn_opt_arg.cont_in_list = NULL;
syn_opt_arg.next_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. // get the pattern.
init_syn_patterns(); init_syn_patterns();
CLEAR_FIELD(item); 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)) { if (vim_regcomp_had_eol() && !(syn_opt_arg.flags & HL_EXCLUDENL)) {
syn_opt_arg.flags |= HL_HAS_EOL; syn_opt_arg.flags |= HL_HAS_EOL;
} }
// Get options after the pattern // 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 if (rest != NULL) { // all arguments are valid
/* /*
* Check for trailing command and illegal trailing arguments. * 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) { if (!ends_excmd(*rest) || eap->skip) {
rest = NULL; rest = NULL;
} else { } 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); syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/* /*
* Store the pattern in the syn_items list * 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 .." /// @param syncing true for ":syntax sync region .."
static void syn_cmd_region(exarg_T *eap, int syncing) static void syn_cmd_region(exarg_T *eap, int syncing)
{ {
char_u *arg = (char_u *)eap->arg; char *arg = eap->arg;
char_u *group_name_end; char *group_name_end;
char_u *rest; // next arg, NULL on error char *rest; // next arg, NULL on error
char_u *key_end; char *key_end;
char_u *key = NULL; char *key = NULL;
char_u *p; char *p;
int item; int item;
#define ITEM_START 0 #define ITEM_START 0
#define ITEM_SKIP 1 #define ITEM_SKIP 1
@ -4573,7 +4568,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
// get the options, patterns and matchgroup. // get the options, patterns and matchgroup.
while (rest != NULL && !ends_excmd(*rest)) { while (rest != NULL && !ends_excmd(*rest)) {
// Check for option arguments // 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)) { if (rest == NULL || ends_excmd(*rest)) {
break; break;
} }
@ -4584,7 +4579,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
key_end++; key_end++;
} }
xfree(key); 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) { if (STRCMP(key, "MATCHGROUP") == 0) {
item = ITEM_MATCHGROUP; item = ITEM_MATCHGROUP;
} else if (STRCMP(key, "START") == 0) { } else if (STRCMP(key, "START") == 0) {
@ -4600,30 +4595,30 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
} else { } else {
break; break;
} }
rest = (char_u *)skipwhite((char *)key_end); rest = skipwhite(key_end);
if (*rest != '=') { if (*rest != '=') {
rest = NULL; rest = NULL;
semsg(_("E398: Missing '=': %s"), arg); semsg(_("E398: Missing '=': %s"), arg);
break; break;
} }
rest = (char_u *)skipwhite((char *)rest + 1); rest = skipwhite(rest + 1);
if (*rest == NUL) { if (*rest == NUL) {
not_enough = true; not_enough = true;
break; break;
} }
if (item == ITEM_MATCHGROUP) { if (item == ITEM_MATCHGROUP) {
p = skiptowhite(rest); p = (char *)skiptowhite((char_u *)rest);
if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip) { if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip) {
matchgroup_id = 0; matchgroup_id = 0;
} else { } 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) { if (matchgroup_id == 0) {
illegal = true; illegal = true;
break; break;
} }
} }
rest = (char_u *)skipwhite((char *)p); rest = skipwhite(p);
} else { } else {
/* /*
* Allocate room for a syn_pattern, and link it in the list of * 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); assert(item == ITEM_SKIP || item == ITEM_END);
reg_do_extmatch = REX_USE; 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; reg_do_extmatch = 0;
if (item == ITEM_END && vim_regcomp_had_eol() if (item == ITEM_END && vim_regcomp_had_eol()
&& !(syn_opt_arg.flags & HL_EXCLUDENL)) { && !(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. * Check for trailing garbage or command.
* If OK, add the item. * 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) { if (!ends_excmd(*rest) || eap->skip) {
rest = NULL; rest = NULL;
} else { } else {
ga_grow(&(curwin->w_s->b_syn_patterns), pat_count); 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); syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/* /*
* Store the start/skip/end in the syn_items list * 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) static void syn_cmd_cluster(exarg_T *eap, int syncing)
{ {
char_u *arg = (char_u *)eap->arg; char *arg = eap->arg;
char_u *group_name_end; char *group_name_end;
char_u *rest; char *rest;
bool got_clstr = false; bool got_clstr = false;
int opt_len; int opt_len;
int list_op; int list_op;
eap->nextcmd = (char *)find_nextcmd(arg); eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
if (eap->skip) { if (eap->skip) {
return; return;
} }
@ -4979,7 +4974,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
rest = get_group_name(arg, &group_name_end); rest = get_group_name(arg, &group_name_end);
if (rest != NULL) { 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) { if (scl_id == 0) {
return; 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! /// @param list where to store the resulting list, if not NULL, the list is silently skipped!
/// ///
/// @return FAIL for some error, OK for success. /// @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 *p = NULL;
char *end; 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. // grow when a regexp is used. In that case round 1 is done once again.
for (int round = 1; round <= 2; round++) { for (int round = 1; round <= 2; round++) {
// skip "contains" // skip "contains"
p = skipwhite((char *)(*arg) + keylen); p = skipwhite(*arg + keylen);
if (*p != '=') { if (*p != '=') {
semsg(_("E405: Missing equal sign: %s"), *arg); semsg(_("E405: Missing equal sign: %s"), *arg);
break; 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) { if (failed || retval == NULL) {
xfree(retval); xfree(retval);
return FAIL; return FAIL;

View File

@ -1780,7 +1780,7 @@ line_read_in:
// encoding to 'encoding'. // encoding to 'encoding'.
for (p = lbuf + 20; *p > ' ' && *p < 127; p++) {} for (p = lbuf + 20; *p > ' ' && *p < 127; p++) {}
*p = NUL; *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. // Read the next line. Unrecognized flags are ignored.

View File

@ -336,7 +336,7 @@ void vim_beep(unsigned val)
// When 'debug' contains "beep" produce a message. If we are sourcing // 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 // a script or executing a function give the user a hint where the beep
// comes from. // comes from.
if (vim_strchr((char *)p_debug, 'e') != NULL) { if (vim_strchr(p_debug, 'e') != NULL) {
msg_source(HL_ATTR(HLF_W)); msg_source(HL_ATTR(HLF_W));
msg_attr(_("Beep!"), 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 // - '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 // - 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). // 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) { switch (*p) {
case 'a': case 'a':
if (vim_strchr(MOUSE_A, checkfor) != NULL) { if (vim_strchr(MOUSE_A, checkfor) != NULL) {

View File

@ -2200,7 +2200,7 @@ void maybe_intro_message(void)
if (buf_is_empty(curbuf) if (buf_is_empty(curbuf)
&& (curbuf->b_fname == NULL) && (curbuf->b_fname == NULL)
&& (firstwin->w_next == NULL) && (firstwin->w_next == NULL)
&& (vim_strchr((char *)p_shm, SHM_INTRO) == NULL)) { && (vim_strchr(p_shm, SHM_INTRO) == NULL)) {
intro_message(false); intro_message(false);
} }
} }