refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
Dundar Goc 2022-07-31 16:20:57 +02:00 committed by Dundar Göc
parent 22f9200302
commit 40855b0143
48 changed files with 504 additions and 523 deletions

View File

@ -1031,7 +1031,7 @@ String nvim_buf_get_name(Buffer buffer, Arena *arena, Error *err)
return rv; return rv;
} }
return cstr_as_string((char *)buf->b_ffname); return cstr_as_string(buf->b_ffname);
} }
/// Sets the full file name for a buffer /// Sets the full file name for a buffer

View File

@ -2044,7 +2044,7 @@ Array nvim_get_mark(String name, Dictionary opts, Error *err)
// Marks are from an open buffer it fnum is non zero // Marks are from an open buffer it fnum is non zero
if (mark->fmark.fnum != 0) { if (mark->fmark.fnum != 0) {
bufnr = mark->fmark.fnum; bufnr = mark->fmark.fnum;
filename = (char *)buflist_nr2name(bufnr, true, true); filename = buflist_nr2name(bufnr, true, true);
allocated = true; allocated = true;
// Marks comes from shada // Marks comes from shada
} else { } else {
@ -2232,7 +2232,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
// If first character doesn't have a defined highlight, // If first character doesn't have a defined highlight,
// add the default highlight at the beginning of the highlight list // add the default highlight at the beginning of the highlight list
if (hltab->start == NULL || ((char *)hltab->start - buf) != 0) { if (hltab->start == NULL || (hltab->start - buf) != 0) {
Dictionary hl_info = ARRAY_DICT_INIT; Dictionary hl_info = ARRAY_DICT_INIT;
grpname = get_default_stl_hl(wp, use_winbar); grpname = get_default_stl_hl(wp, use_winbar);

View File

@ -157,7 +157,7 @@ void alist_add(alist_T *al, char *fname, int set_fnum)
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
slash_adjust(fname); slash_adjust(fname);
#endif #endif
AARGLIST(al)[al->al_ga.ga_len].ae_fname = (char_u *)fname; AARGLIST(al)[al->al_ga.ga_len].ae_fname = fname;
if (set_fnum > 0) { if (set_fnum > 0) {
AARGLIST(al)[al->al_ga.ga_len].ae_fnum = AARGLIST(al)[al->al_ga.ga_len].ae_fnum =
buflist_add(fname, BLN_LISTED | (set_fnum == 2 ? BLN_CURBUF : 0)); buflist_add(fname, BLN_LISTED | (set_fnum == 2 ? BLN_CURBUF : 0));
@ -226,7 +226,7 @@ static char *do_one_arg(char *str)
/// growarray "gap". /// growarray "gap".
static void get_arglist(garray_T *gap, char *str, int escaped) static void get_arglist(garray_T *gap, char *str, int escaped)
{ {
ga_init(gap, (int)sizeof(char_u *), 20); ga_init(gap, (int)sizeof(char *), 20);
while (*str != NUL) { while (*str != NUL) {
GA_APPEND(char *, gap, str); GA_APPEND(char *, gap, str);
@ -244,12 +244,12 @@ static void get_arglist(garray_T *gap, char *str, int escaped)
/// "fnames[fcountp]". When "wig" is true, removes files matching 'wildignore'. /// "fnames[fcountp]". When "wig" is true, removes files matching 'wildignore'.
/// ///
/// @return FAIL or OK. /// @return FAIL or OK.
int get_arglist_exp(char_u *str, int *fcountp, char ***fnamesp, bool wig) int get_arglist_exp(char *str, int *fcountp, char ***fnamesp, bool wig)
{ {
garray_T ga; garray_T ga;
int i; int i;
get_arglist(&ga, (char *)str, true); get_arglist(&ga, str, true);
if (wig) { if (wig) {
i = expand_wildcards(ga.ga_len, ga.ga_data, i = expand_wildcards(ga.ga_len, ga.ga_data,
@ -297,7 +297,7 @@ static void alist_add_list(int count, char **files, int after, bool will_edit)
} }
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
const int flags = BLN_LISTED | (will_edit ? BLN_CURBUF : 0); const int flags = BLN_LISTED | (will_edit ? BLN_CURBUF : 0);
ARGLIST[after + i].ae_fname = (char_u *)files[i]; ARGLIST[after + i].ae_fname = files[i];
ARGLIST[after + i].ae_fnum = buflist_add(files[i], flags); ARGLIST[after + i].ae_fnum = buflist_add(files[i], flags);
} }
ALIST(curwin)->al_ga.ga_len += count; ALIST(curwin)->al_ga.ga_len += count;
@ -377,7 +377,7 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
vim_regfree(regmatch.regprog); vim_regfree(regmatch.regprog);
xfree(p); xfree(p);
if (!didone) { if (!didone) {
semsg(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]); semsg(_(e_nomatch2), ((char **)new_ga.ga_data)[i]);
} }
} }
ga_clear(&new_ga); ga_clear(&new_ga);
@ -472,7 +472,7 @@ void ex_args(exarg_T *eap)
} else if (eap->cmdidx == CMD_args) { } else if (eap->cmdidx == CMD_args) {
// ":args": list arguments. // ":args": list arguments.
if (ARGCOUNT > 0) { if (ARGCOUNT > 0) {
char **items = xmalloc(sizeof(char_u *) * (size_t)ARGCOUNT); char **items = xmalloc(sizeof(char *) * (size_t)ARGCOUNT);
// Overwrite the command, for a short list there is no scrolling // Overwrite the command, for a short list there is no scrolling
// required and no wait_return(). // required and no wait_return().
gotocmdline(true); gotocmdline(true);
@ -489,10 +489,8 @@ void ex_args(exarg_T *eap)
ga_grow(gap, GARGCOUNT); ga_grow(gap, GARGCOUNT);
for (int i = 0; i < GARGCOUNT; i++) { for (int i = 0; i < GARGCOUNT; i++) {
if (GARGLIST[i].ae_fname != NULL) { if (GARGLIST[i].ae_fname != NULL) {
AARGLIST(curwin->w_alist)[gap->ga_len].ae_fname = AARGLIST(curwin->w_alist)[gap->ga_len].ae_fname = xstrdup(GARGLIST[i].ae_fname);
vim_strsave(GARGLIST[i].ae_fname); AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum = GARGLIST[i].ae_fnum;
AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum =
GARGLIST[i].ae_fnum;
gap->ga_len++; gap->ga_len++;
} }
} }
@ -742,7 +740,7 @@ char *alist_name(aentry_T *aep)
// Use the name from the associated buffer if it exists. // Use the name from the associated buffer if it exists.
bp = buflist_findnr(aep->ae_fnum); bp = buflist_findnr(aep->ae_fnum);
if (bp == NULL || bp->b_fname == NULL) { if (bp == NULL || bp->b_fname == NULL) {
return (char *)aep->ae_fname; return aep->ae_fname;
} }
return bp->b_fname; return bp->b_fname;
} }

View File

@ -1720,9 +1720,9 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
fname = NULL; fname = NULL;
} else { } else {
if (event == EVENT_SYNTAX) { if (event == EVENT_SYNTAX) {
fname = (char *)buf->b_p_syn; fname = buf->b_p_syn;
} else if (event == EVENT_FILETYPE) { } else if (event == EVENT_FILETYPE) {
fname = (char *)buf->b_p_ft; fname = buf->b_p_ft;
} else { } else {
if (buf->b_sfname != NULL) { if (buf->b_sfname != NULL) {
sfname = xstrdup(buf->b_sfname); sfname = xstrdup(buf->b_sfname);

View File

@ -116,11 +116,11 @@ typedef uint64_t disptick_T; // display tick type
* The taggy struct is used to store the information about a :tag command. * The taggy struct is used to store the information about a :tag command.
*/ */
typedef struct taggy { typedef struct taggy {
char_u *tagname; // tag name char *tagname; // tag name
fmark_T fmark; // cursor position BEFORE ":tag" fmark_T fmark; // cursor position BEFORE ":tag"
int cur_match; // match number int cur_match; // match number
int cur_fnum; // buffer number used for cur_match int cur_fnum; // buffer number used for cur_match
char_u *user_data; // used with tagfunc char *user_data; // used with tagfunc
} taggy_T; } taggy_T;
typedef struct buffblock buffblock_T; typedef struct buffblock buffblock_T;
@ -131,7 +131,7 @@ typedef struct buffheader buffheader_T;
*/ */
struct buffblock { struct buffblock {
buffblock_T *b_next; // pointer to next buffblock buffblock_T *b_next; // pointer to next buffblock
char_u b_str[1]; // contents (actually longer) char b_str[1]; // contents (actually longer)
}; };
/* /*
@ -159,39 +159,39 @@ typedef struct {
#define w_p_arab w_onebuf_opt.wo_arab // 'arabic' #define w_p_arab w_onebuf_opt.wo_arab // 'arabic'
int wo_bri; int wo_bri;
#define w_p_bri w_onebuf_opt.wo_bri // 'breakindent' #define w_p_bri w_onebuf_opt.wo_bri // 'breakindent'
char_u *wo_briopt; char *wo_briopt;
#define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt' #define w_p_briopt w_onebuf_opt.wo_briopt // 'breakindentopt'
int wo_diff; int wo_diff;
#define w_p_diff w_onebuf_opt.wo_diff // 'diff' #define w_p_diff w_onebuf_opt.wo_diff // 'diff'
char_u *wo_fdc; char *wo_fdc;
#define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn' #define w_p_fdc w_onebuf_opt.wo_fdc // 'foldcolumn'
char_u *wo_fdc_save; char *wo_fdc_save;
#define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'fdc' saved for diff mode #define w_p_fdc_save w_onebuf_opt.wo_fdc_save // 'fdc' saved for diff mode
int wo_fen; int wo_fen;
#define w_p_fen w_onebuf_opt.wo_fen // 'foldenable' #define w_p_fen w_onebuf_opt.wo_fen // 'foldenable'
int wo_fen_save; int wo_fen_save;
// 'foldenable' saved for diff mode // 'foldenable' saved for diff mode
#define w_p_fen_save w_onebuf_opt.wo_fen_save #define w_p_fen_save w_onebuf_opt.wo_fen_save
char_u *wo_fdi; char *wo_fdi;
#define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore' #define w_p_fdi w_onebuf_opt.wo_fdi // 'foldignore'
long wo_fdl; long wo_fdl;
#define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel' #define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel'
long wo_fdl_save; long wo_fdl_save;
// 'foldlevel' state saved for diff mode // 'foldlevel' state saved for diff mode
#define w_p_fdl_save w_onebuf_opt.wo_fdl_save #define w_p_fdl_save w_onebuf_opt.wo_fdl_save
char_u *wo_fdm; char *wo_fdm;
#define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod' #define w_p_fdm w_onebuf_opt.wo_fdm // 'foldmethod'
char_u *wo_fdm_save; char *wo_fdm_save;
#define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode #define w_p_fdm_save w_onebuf_opt.wo_fdm_save // 'fdm' saved for diff mode
long wo_fml; long wo_fml;
#define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines' #define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines'
long wo_fdn; long wo_fdn;
#define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax' #define w_p_fdn w_onebuf_opt.wo_fdn // 'foldnestmax'
char_u *wo_fde; char *wo_fde;
#define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr' #define w_p_fde w_onebuf_opt.wo_fde // 'foldexpr'
char_u *wo_fdt; char *wo_fdt;
#define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext' #define w_p_fdt w_onebuf_opt.wo_fdt // 'foldtext'
char_u *wo_fmr; char *wo_fmr;
#define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker' #define w_p_fmr w_onebuf_opt.wo_fmr // 'foldmarker'
int wo_lbr; int wo_lbr;
#define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak' #define w_p_lbr w_onebuf_opt.wo_lbr // 'linebreak'
@ -201,7 +201,7 @@ typedef struct {
#define w_p_nu w_onebuf_opt.wo_nu // 'number' #define w_p_nu w_onebuf_opt.wo_nu // 'number'
int wo_rnu; int wo_rnu;
#define w_p_rnu w_onebuf_opt.wo_rnu // 'relativenumber' #define w_p_rnu w_onebuf_opt.wo_rnu // 'relativenumber'
char_u *wo_ve; char *wo_ve;
#define w_p_ve w_onebuf_opt.wo_ve // 'virtualedit' #define w_p_ve w_onebuf_opt.wo_ve // 'virtualedit'
unsigned wo_ve_flags; unsigned wo_ve_flags;
#define w_ve_flags w_onebuf_opt.wo_ve_flags // flags for 'virtualedit' #define w_ve_flags w_onebuf_opt.wo_ve_flags // flags for 'virtualedit'
@ -215,7 +215,7 @@ typedef struct {
#define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow' #define w_p_pvw w_onebuf_opt.wo_pvw // 'previewwindow'
int wo_rl; int wo_rl;
#define w_p_rl w_onebuf_opt.wo_rl // 'rightleft' #define w_p_rl w_onebuf_opt.wo_rl // 'rightleft'
char_u *wo_rlc; char *wo_rlc;
#define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd' #define w_p_rlc w_onebuf_opt.wo_rlc // 'rightleftcmd'
long wo_scr; long wo_scr;
#define w_p_scr w_onebuf_opt.wo_scr // 'scroll' #define w_p_scr w_onebuf_opt.wo_scr // 'scroll'
@ -225,13 +225,13 @@ typedef struct {
#define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn' #define w_p_cuc w_onebuf_opt.wo_cuc // 'cursorcolumn'
int wo_cul; int wo_cul;
#define w_p_cul w_onebuf_opt.wo_cul // 'cursorline' #define w_p_cul w_onebuf_opt.wo_cul // 'cursorline'
char_u *wo_culopt; char *wo_culopt;
#define w_p_culopt w_onebuf_opt.wo_culopt // 'cursorlineopt' #define w_p_culopt w_onebuf_opt.wo_culopt // 'cursorlineopt'
char_u *wo_cc; char *wo_cc;
#define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn' #define w_p_cc w_onebuf_opt.wo_cc // 'colorcolumn'
char_u *wo_sbr; char *wo_sbr;
#define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak' #define w_p_sbr w_onebuf_opt.wo_sbr // 'showbreak'
char_u *wo_stl; char *wo_stl;
#define w_p_stl w_onebuf_opt.wo_stl // 'statusline' #define w_p_stl w_onebuf_opt.wo_stl // 'statusline'
char *wo_wbr; char *wo_wbr;
#define w_p_wbr w_onebuf_opt.wo_wbr // 'winbar' #define w_p_wbr w_onebuf_opt.wo_wbr // 'winbar'
@ -245,7 +245,7 @@ typedef struct {
#define w_p_wrap w_onebuf_opt.wo_wrap // 'wrap' #define w_p_wrap w_onebuf_opt.wo_wrap // 'wrap'
int wo_wrap_save; // 'wrap' state saved for diff mode int wo_wrap_save; // 'wrap' state saved for diff mode
#define w_p_wrap_save w_onebuf_opt.wo_wrap_save #define w_p_wrap_save w_onebuf_opt.wo_wrap_save
char_u *wo_cocu; // 'concealcursor' char *wo_cocu; // 'concealcursor'
#define w_p_cocu w_onebuf_opt.wo_cocu #define w_p_cocu w_onebuf_opt.wo_cocu
long wo_cole; // 'conceallevel' long wo_cole; // 'conceallevel'
#define w_p_cole w_onebuf_opt.wo_cole #define w_p_cole w_onebuf_opt.wo_cole
@ -253,13 +253,13 @@ typedef struct {
#define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind' #define w_p_crb w_onebuf_opt.wo_crb // 'cursorbind'
int wo_crb_save; // 'cursorbind' state saved for diff mode int wo_crb_save; // 'cursorbind' state saved for diff mode
#define w_p_crb_save w_onebuf_opt.wo_crb_save #define w_p_crb_save w_onebuf_opt.wo_crb_save
char_u *wo_scl; char *wo_scl;
#define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn' #define w_p_scl w_onebuf_opt.wo_scl // 'signcolumn'
char_u *wo_winhl; char *wo_winhl;
#define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight' #define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
char_u *wo_fcs; char *wo_fcs;
#define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars' #define w_p_fcs w_onebuf_opt.wo_fcs // 'fillchars'
char_u *wo_lcs; char *wo_lcs;
#define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars' #define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars'
long wo_winbl; long wo_winbl;
#define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend' #define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend'
@ -308,8 +308,8 @@ typedef struct arglist {
// //
// TODO(Felipe): move aentry_T to another header // TODO(Felipe): move aentry_T to another header
typedef struct argentry { typedef struct argentry {
char_u *ae_fname; // file name as specified char *ae_fname; // file name as specified
int ae_fnum; // buffer number with expanded file name int ae_fnum; // buffer number with expanded file name
} aentry_T; } aentry_T;
#define ALIST(win) (win)->w_alist #define ALIST(win) (win)->w_alist
@ -326,7 +326,7 @@ typedef struct argentry {
*/ */
typedef struct { typedef struct {
char_u *tb_buf; // buffer for typed characters char_u *tb_buf; // buffer for typed characters
char_u *tb_noremap; // mapping flags for characters in tb_buf[] uint8_t *tb_noremap; // mapping flags for characters in tb_buf[]
int tb_buflen; // size of tb_buf[] int tb_buflen; // size of tb_buf[]
int tb_off; // current position in tb_buf[] int tb_off; // current position in tb_buf[]
int tb_len; // number of valid bytes in tb_buf[] int tb_len; // number of valid bytes in tb_buf[]
@ -352,11 +352,11 @@ typedef struct {
*/ */
typedef struct mapblock mapblock_T; typedef struct mapblock mapblock_T;
struct mapblock { struct mapblock {
mapblock_T *m_next; // next mapblock in list mapblock_T *m_next; // next mapblock in list
char_u *m_keys; // mapped from, lhs char_u *m_keys; // mapped from, lhs
char_u *m_str; // mapped to, rhs char *m_str; // mapped to, rhs
char_u *m_orig_str; // rhs as entered by the user char *m_orig_str; // rhs as entered by the user
LuaRef m_luaref; // lua function reference as rhs LuaRef m_luaref; // lua function reference as rhs
int m_keylen; // strlen(m_keys) int m_keylen; // strlen(m_keys)
int m_mode; // valid mode int m_mode; // valid mode
int m_simplified; // m_keys was simplified, do no use this map int m_simplified; // m_keys was simplified, do no use this map
@ -447,7 +447,7 @@ typedef struct {
linenr_T b_syn_sync_minlines; // minimal sync lines offset linenr_T b_syn_sync_minlines; // minimal sync lines offset
linenr_T b_syn_sync_maxlines; // maximal sync lines offset linenr_T b_syn_sync_maxlines; // maximal sync lines offset
linenr_T b_syn_sync_linebreaks; // offset for multi-line pattern linenr_T b_syn_sync_linebreaks; // offset for multi-line pattern
char_u *b_syn_linecont_pat; // line continuation pattern char *b_syn_linecont_pat; // line continuation pattern
regprog_T *b_syn_linecont_prog; // line continuation program regprog_T *b_syn_linecont_prog; // line continuation program
syn_time_T b_syn_linecont_time; syn_time_T b_syn_linecont_time;
int b_syn_linecont_ic; // ignore-case flag for above int b_syn_linecont_ic; // ignore-case flag for above
@ -476,17 +476,17 @@ typedef struct {
disptick_T b_sst_lasttick; // last display tick disptick_T b_sst_lasttick; // last display tick
// for spell checking // for spell checking
garray_T b_langp; // list of pointers to slang_T, see spell.c garray_T b_langp; // list of pointers to slang_T, see spell.c
bool b_spell_ismw[256]; // flags: is midword char bool b_spell_ismw[256]; // flags: is midword char
char_u *b_spell_ismw_mb; // multi-byte midword chars char *b_spell_ismw_mb; // multi-byte midword chars
char_u *b_p_spc; // 'spellcapcheck' char *b_p_spc; // 'spellcapcheck'
regprog_T *b_cap_prog; // program for 'spellcapcheck' regprog_T *b_cap_prog; // program for 'spellcapcheck'
char_u *b_p_spf; // 'spellfile' char *b_p_spf; // 'spellfile'
char_u *b_p_spl; // 'spelllang' char *b_p_spl; // 'spelllang'
char_u *b_p_spo; // 'spelloptions' char *b_p_spo; // 'spelloptions'
int b_cjk; // all CJK letters as OK int b_cjk; // all CJK letters as OK
char_u b_syn_chartab[32]; // syntax iskeyword option uint8_t b_syn_chartab[32]; // syntax iskeyword option
char_u *b_syn_isk; // iskeyword option char *b_syn_isk; // iskeyword option
} synblock_T; } synblock_T;
/// Type used for changedtick_di member in buf_T /// Type used for changedtick_di member in buf_T
@ -653,10 +653,8 @@ struct file_buffer {
time_t b_u_time_cur; // uh_time of header below which we are now time_t b_u_time_cur; // uh_time of header below which we are now
long b_u_save_nr_cur; // file write nr after which we are now long b_u_save_nr_cur; // file write nr after which we are now
/* // variables for "U" command in undo.c
* variables for "U" command in undo.c char *b_u_line_ptr; // saved line for "U" command
*/
char_u *b_u_line_ptr; // saved line for "U" command
linenr_T b_u_line_lnum; // line number of line in u_line linenr_T b_u_line_lnum; // line number of line in u_line
colnr_T b_u_line_colnr; // optional column number colnr_T b_u_line_colnr; // optional column number
@ -686,72 +684,72 @@ struct file_buffer {
int b_p_ai; ///< 'autoindent' int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode int b_p_ai_nopaste; ///< b_p_ai saved for paste mode
char_u *b_p_bkc; ///< 'backupco char *b_p_bkc; ///< 'backupco
unsigned int b_bkc_flags; ///< flags for 'backupco unsigned int b_bkc_flags; ///< flags for 'backupco
int b_p_ci; ///< 'copyindent' int b_p_ci; ///< 'copyindent'
int b_p_bin; ///< 'binary' int b_p_bin; ///< 'binary'
int b_p_bomb; ///< 'bomb' int b_p_bomb; ///< 'bomb'
char_u *b_p_bh; ///< 'bufhidden' char *b_p_bh; ///< 'bufhidden'
char_u *b_p_bt; ///< 'buftype' char *b_p_bt; ///< 'buftype'
int b_has_qf_entry; ///< quickfix exists for buffer int b_has_qf_entry; ///< quickfix exists for buffer
int b_p_bl; ///< 'buflisted' int b_p_bl; ///< 'buflisted'
long b_p_channel; ///< 'channel' long b_p_channel; ///< 'channel'
int b_p_cin; ///< 'cindent' int b_p_cin; ///< 'cindent'
char_u *b_p_cino; ///< 'cinoptions' char *b_p_cino; ///< 'cinoptions'
char_u *b_p_cink; ///< 'cinkeys' char *b_p_cink; ///< 'cinkeys'
char_u *b_p_cinw; ///< 'cinwords' char *b_p_cinw; ///< 'cinwords'
char_u *b_p_cinsd; ///< 'cinscopedecls' char *b_p_cinsd; ///< 'cinscopedecls'
char_u *b_p_com; ///< 'comments' char *b_p_com; ///< 'comments'
char_u *b_p_cms; ///< 'commentstring' char *b_p_cms; ///< 'commentstring'
char_u *b_p_cpt; ///< 'complete' char *b_p_cpt; ///< 'complete'
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
char_u *b_p_csl; ///< 'completeslash' char_u *b_p_csl; ///< 'completeslash'
#endif #endif
char_u *b_p_cfu; ///< 'completefunc' char *b_p_cfu; ///< 'completefunc'
char_u *b_p_ofu; ///< 'omnifunc' char *b_p_ofu; ///< 'omnifunc'
char_u *b_p_tfu; ///< 'tagfunc' char *b_p_tfu; ///< 'tagfunc'
int b_p_eol; ///< 'endofline' int b_p_eol; ///< 'endofline'
int b_p_fixeol; ///< 'fixendofline' int b_p_fixeol; ///< 'fixendofline'
int b_p_et; ///< 'expandtab' int b_p_et; ///< 'expandtab'
int b_p_et_nobin; ///< b_p_et saved for binary mode int b_p_et_nobin; ///< b_p_et saved for binary mode
int b_p_et_nopaste; ///< b_p_et saved for paste mode int b_p_et_nopaste; ///< b_p_et saved for paste mode
char_u *b_p_fenc; ///< 'fileencoding' char *b_p_fenc; ///< 'fileencoding'
char_u *b_p_ff; ///< 'fileformat' char *b_p_ff; ///< 'fileformat'
char_u *b_p_ft; ///< 'filetype' char *b_p_ft; ///< 'filetype'
char_u *b_p_fo; ///< 'formatoptions' char *b_p_fo; ///< 'formatoptions'
char_u *b_p_flp; ///< 'formatlistpat' char *b_p_flp; ///< 'formatlistpat'
int b_p_inf; ///< 'infercase' int b_p_inf; ///< 'infercase'
char_u *b_p_isk; ///< 'iskeyword' char *b_p_isk; ///< 'iskeyword'
char_u *b_p_def; ///< 'define' local value char *b_p_def; ///< 'define' local value
char_u *b_p_inc; ///< 'include' char *b_p_inc; ///< 'include'
char_u *b_p_inex; ///< 'includeexpr' char *b_p_inex; ///< 'includeexpr'
uint32_t b_p_inex_flags; ///< flags for 'includeexpr' uint32_t b_p_inex_flags; ///< flags for 'includeexpr'
char_u *b_p_inde; ///< 'indentexpr' char *b_p_inde; ///< 'indentexpr'
uint32_t b_p_inde_flags; ///< flags for 'indentexpr' uint32_t b_p_inde_flags; ///< flags for 'indentexpr'
char_u *b_p_indk; ///< 'indentkeys' char *b_p_indk; ///< 'indentkeys'
char_u *b_p_fp; ///< 'formatprg' char *b_p_fp; ///< 'formatprg'
char_u *b_p_fex; ///< 'formatexpr' char *b_p_fex; ///< 'formatexpr'
uint32_t b_p_fex_flags; ///< flags for 'formatexpr' uint32_t b_p_fex_flags; ///< flags for 'formatexpr'
char_u *b_p_kp; ///< 'keywordprg' char *b_p_kp; ///< 'keywordprg'
int b_p_lisp; ///< 'lisp' int b_p_lisp; ///< 'lisp'
char_u *b_p_menc; ///< 'makeencoding' char *b_p_menc; ///< 'makeencoding'
char_u *b_p_mps; ///< 'matchpairs' char *b_p_mps; ///< 'matchpairs'
int b_p_ml; ///< 'modeline' int b_p_ml; ///< 'modeline'
int b_p_ml_nobin; ///< b_p_ml saved for binary mode int b_p_ml_nobin; ///< b_p_ml saved for binary mode
int b_p_ma; ///< 'modifiable' int b_p_ma; ///< 'modifiable'
char_u *b_p_nf; ///< 'nrformats' char *b_p_nf; ///< 'nrformats'
int b_p_pi; ///< 'preserveindent' int b_p_pi; ///< 'preserveindent'
char_u *b_p_qe; ///< 'quoteescape' char *b_p_qe; ///< 'quoteescape'
int b_p_ro; ///< 'readonly' int b_p_ro; ///< 'readonly'
long b_p_sw; ///< 'shiftwidth' long b_p_sw; ///< 'shiftwidth'
long b_p_scbk; ///< 'scrollback' long b_p_scbk; ///< 'scrollback'
int b_p_si; ///< 'smartindent' int b_p_si; ///< 'smartindent'
long b_p_sts; ///< 'softtabstop' long b_p_sts; ///< 'softtabstop'
long b_p_sts_nopaste; ///< b_p_sts saved for paste mode long b_p_sts_nopaste; ///< b_p_sts saved for paste mode
char_u *b_p_sua; ///< 'suffixesadd' char *b_p_sua; ///< 'suffixesadd'
int b_p_swf; ///< 'swapfile' int b_p_swf; ///< 'swapfile'
long b_p_smc; ///< 'synmaxcol' long b_p_smc; ///< 'synmaxcol'
char_u *b_p_syn; ///< 'syntax' char *b_p_syn; ///< 'syntax'
long b_p_ts; ///< 'tabstop' long b_p_ts; ///< 'tabstop'
long b_p_tw; ///< 'textwidth' long b_p_tw; ///< 'textwidth'
long b_p_tw_nobin; ///< b_p_tw saved for binary mode long b_p_tw_nobin; ///< b_p_tw saved for binary mode
@ -759,29 +757,29 @@ struct file_buffer {
long b_p_wm; ///< 'wrapmargin' long b_p_wm; ///< 'wrapmargin'
long b_p_wm_nobin; ///< b_p_wm saved for binary mode long b_p_wm_nobin; ///< b_p_wm saved for binary mode
long b_p_wm_nopaste; ///< b_p_wm saved for paste mode long b_p_wm_nopaste; ///< b_p_wm saved for paste mode
char_u *b_p_vsts; ///< 'varsofttabstop' char *b_p_vsts; ///< 'varsofttabstop'
long *b_p_vsts_array; ///< 'varsofttabstop' in internal format long *b_p_vsts_array; ///< 'varsofttabstop' in internal format
char_u *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode char *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode
char_u *b_p_vts; ///< 'vartabstop' char *b_p_vts; ///< 'vartabstop'
long *b_p_vts_array; ///< 'vartabstop' in internal format long *b_p_vts_array; ///< 'vartabstop' in internal format
char_u *b_p_keymap; ///< 'keymap' char *b_p_keymap; ///< 'keymap'
// local values for options which are normally global // local values for options which are normally global
char_u *b_p_gp; ///< 'grepprg' local value char *b_p_gp; ///< 'grepprg' local value
char_u *b_p_mp; ///< 'makeprg' local value char *b_p_mp; ///< 'makeprg' local value
char_u *b_p_efm; ///< 'errorformat' local value char *b_p_efm; ///< 'errorformat' local value
char_u *b_p_ep; ///< 'equalprg' local value char *b_p_ep; ///< 'equalprg' local value
char_u *b_p_path; ///< 'path' local value char *b_p_path; ///< 'path' local value
int b_p_ar; ///< 'autoread' local value int b_p_ar; ///< 'autoread' local value
char_u *b_p_tags; ///< 'tags' local value char *b_p_tags; ///< 'tags' local value
char_u *b_p_tc; ///< 'tagcase' local value char *b_p_tc; ///< 'tagcase' local value
unsigned b_tc_flags; ///< flags for 'tagcase' unsigned b_tc_flags; ///< flags for 'tagcase'
char_u *b_p_dict; ///< 'dictionary' local value char *b_p_dict; ///< 'dictionary' local value
char_u *b_p_tsr; ///< 'thesaurus' local value char *b_p_tsr; ///< 'thesaurus' local value
char_u *b_p_tsrfu; ///< 'thesaurusfunc' local value char *b_p_tsrfu; ///< 'thesaurusfunc' local value
long b_p_ul; ///< 'undolevels' local value long b_p_ul; ///< 'undolevels' local value
int b_p_udf; ///< 'undofile' int b_p_udf; ///< 'undofile'
char_u *b_p_lw; ///< 'lispwords' local value char *b_p_lw; ///< 'lispwords' local value
// end of buffer options // end of buffer options

View File

@ -536,9 +536,9 @@ void unchanged(buf_T *buf, int ff, bool always_inc_changedtick)
/// Insert string "p" at the cursor position. Stops at a NUL byte. /// Insert string "p" at the cursor position. Stops at a NUL byte.
/// Handles Replace mode and multi-byte characters. /// Handles Replace mode and multi-byte characters.
void ins_bytes(char_u *p) void ins_bytes(char *p)
{ {
ins_bytes_len(p, STRLEN(p)); ins_bytes_len((char_u *)p, STRLEN(p));
} }
/// Insert string "p" with length "len" at the cursor position. /// Insert string "p" with length "len" at the cursor position.
@ -1309,10 +1309,10 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Doing "O" on the end of a comment inserts the middle leader. // Doing "O" on the end of a comment inserts the middle leader.
// Find the string for the middle leader, searching backwards. // Find the string for the middle leader, searching backwards.
while (p > (char *)curbuf->b_p_com && *p != ',') { while (p > curbuf->b_p_com && *p != ',') {
p--; p--;
} }
for (lead_repl = p; lead_repl > (char *)curbuf->b_p_com for (lead_repl = p; lead_repl > curbuf->b_p_com
&& lead_repl[-1] != ':'; lead_repl--) {} && lead_repl[-1] != ':'; lead_repl--) {}
lead_repl_len = (int)(p - lead_repl); lead_repl_len = (int)(p - lead_repl);
@ -1795,7 +1795,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Insert new stuff into line again // Insert new stuff into line again
curwin->w_cursor.col = 0; curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0; curwin->w_cursor.coladd = 0;
ins_bytes(p_extra); // will call changed_bytes() ins_bytes((char *)p_extra); // will call changed_bytes()
xfree(p_extra); xfree(p_extra);
next_line = NULL; next_line = NULL;
} }
@ -1814,16 +1814,16 @@ theend:
/// If "fixpos" is true fix the cursor position when done. /// If "fixpos" is true fix the cursor position when done.
void truncate_line(int fixpos) void truncate_line(int fixpos)
{ {
char_u *newp; char *newp;
linenr_T lnum = curwin->w_cursor.lnum; linenr_T lnum = curwin->w_cursor.lnum;
colnr_T col = curwin->w_cursor.col; colnr_T col = curwin->w_cursor.col;
if (col == 0) { if (col == 0) {
newp = vim_strsave((char_u *)""); newp = xstrdup("");
} else { } else {
newp = vim_strnsave(ml_get(lnum), (size_t)col); newp = (char *)vim_strnsave(ml_get(lnum), (size_t)col);
} }
ml_replace(lnum, (char *)newp, false); ml_replace(lnum, newp, false);
// mark the buffer as changed and prepare for displaying // mark the buffer as changed and prepare for displaying
changed_bytes(lnum, curwin->w_cursor.col); changed_bytes(lnum, curwin->w_cursor.col);
@ -1900,7 +1900,7 @@ int get_leader_len(char *line, char **flags, bool backward, bool include_space)
while (line[i] != NUL) { while (line[i] != NUL) {
// scan through the 'comments' option for a match // scan through the 'comments' option for a match
int found_one = false; int found_one = false;
for (list = (char *)curbuf->b_p_com; *list;) { for (list = curbuf->b_p_com; *list;) {
// Get one option part into part_buf[]. Advance "list" to next // Get one option part into part_buf[]. Advance "list" to next
// one. Put "string" at start of string. // one. Put "string" at start of string.
if (!got_com && flags != NULL) { if (!got_com && flags != NULL) {
@ -2037,7 +2037,7 @@ int get_last_leader_offset(char *line, char **flags)
while (--i >= lower_check_bound) { while (--i >= lower_check_bound) {
// scan through the 'comments' option for a match // scan through the 'comments' option for a match
int found_one = false; int found_one = false;
for (list = (char *)curbuf->b_p_com; *list;) { for (list = curbuf->b_p_com; *list;) {
char *flags_save = list; char *flags_save = list;
// Get one option part into part_buf[]. Advance list to next one. // Get one option part into part_buf[]. Advance list to next one.
@ -2122,7 +2122,7 @@ int get_last_leader_offset(char *line, char **flags)
} }
len1 = (int)STRLEN(com_leader); len1 = (int)STRLEN(com_leader);
for (list = (char *)curbuf->b_p_com; *list;) { for (list = curbuf->b_p_com; *list;) {
char *flags_save = list; char *flags_save = list;
(void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ","); (void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ",");

View File

@ -149,7 +149,7 @@ int buf_init_chartab(buf_T *buf, int global)
p = p_isf; p = p_isf;
} else { // i == 3 } else { // i == 3
// fourth round: 'iskeyword' // fourth round: 'iskeyword'
p = buf->b_p_isk; p = (char_u *)buf->b_p_isk;
} }
while (*p) { while (*p) {

View File

@ -797,8 +797,8 @@ static int diff_write(buf_T *buf, diffin_T *din)
} }
// Always use 'fileformat' set to "unix". // Always use 'fileformat' set to "unix".
char_u *save_ff = buf->b_p_ff; char *save_ff = buf->b_p_ff;
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); buf->b_p_ff = xstrdup(FF_UNIX);
const bool save_cmod_flags = cmdmod.cmod_flags; const bool save_cmod_flags = cmdmod.cmod_flags;
// Writing the buffer is an implementation detail of performing the diff, // Writing the buffer is an implementation detail of performing the diff,
// so it shouldn't update the '[ and '] marks. // so it shouldn't update the '[ and '] marks.
@ -1413,7 +1413,7 @@ void diff_win_options(win_T *wp, int addbuf)
if (wp->w_p_diff_saved) { if (wp->w_p_diff_saved) {
free_string_option(wp->w_p_fdm_save); free_string_option(wp->w_p_fdm_save);
} }
wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm); wp->w_p_fdm_save = xstrdup(wp->w_p_fdm);
} }
set_string_option_direct_in_win(wp, "fdm", -1, "diff", OPT_LOCAL | OPT_FREE, 0); set_string_option_direct_in_win(wp, "fdm", -1, "diff", OPT_LOCAL | OPT_FREE, 0);
@ -1424,12 +1424,12 @@ void diff_win_options(win_T *wp, int addbuf)
if (wp->w_p_diff_saved) { if (wp->w_p_diff_saved) {
free_string_option(wp->w_p_fdc_save); free_string_option(wp->w_p_fdc_save);
} }
wp->w_p_fdc_save = vim_strsave(wp->w_p_fdc); wp->w_p_fdc_save = xstrdup(wp->w_p_fdc);
} }
free_string_option(wp->w_p_fdc); free_string_option(wp->w_p_fdc);
wp->w_p_fdc = (char_u *)xstrdup("2"); wp->w_p_fdc = xstrdup("2");
assert(diff_foldcolumn >= 0 && diff_foldcolumn <= 9); assert(diff_foldcolumn >= 0 && diff_foldcolumn <= 9);
snprintf((char *)wp->w_p_fdc, STRLEN(wp->w_p_fdc) + 1, "%d", diff_foldcolumn); snprintf(wp->w_p_fdc, STRLEN(wp->w_p_fdc) + 1, "%d", diff_foldcolumn);
wp->w_p_fen = true; wp->w_p_fen = true;
wp->w_p_fdl = 0; wp->w_p_fdl = 0;
foldUpdateAll(wp); foldUpdateAll(wp);
@ -1480,11 +1480,9 @@ void ex_diffoff(exarg_T *eap)
} }
} }
free_string_option(wp->w_p_fdm); free_string_option(wp->w_p_fdm);
wp->w_p_fdm = vim_strsave(*wp->w_p_fdm_save wp->w_p_fdm = xstrdup(*wp->w_p_fdm_save ? wp->w_p_fdm_save : "manual");
? wp->w_p_fdm_save
: (char_u *)"manual");
free_string_option(wp->w_p_fdc); free_string_option(wp->w_p_fdc);
wp->w_p_fdc = vim_strsave(wp->w_p_fdc_save); wp->w_p_fdc = xstrdup(wp->w_p_fdc_save);
if (wp->w_p_fdl == 0) { if (wp->w_p_fdl == 0) {
wp->w_p_fdl = wp->w_p_fdl_save; wp->w_p_fdl = wp->w_p_fdl_save;

View File

@ -2082,7 +2082,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
if (wp->w_p_cole > 0 if (wp->w_p_cole > 0
&& (wp != curwin || lnum != wp->w_cursor.lnum || conceal_cursor_line(wp)) && (wp != curwin || lnum != wp->w_cursor.lnum || conceal_cursor_line(wp))
&& ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0 || decor_conceal > 0) && ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0 || decor_conceal > 0)
&& !(lnum_in_visual_area && vim_strchr((char *)wp->w_p_cocu, 'v') == NULL)) { && !(lnum_in_visual_area && vim_strchr(wp->w_p_cocu, 'v') == NULL)) {
char_attr = conceal_attr; char_attr = conceal_attr;
if (((prev_syntax_id != syntax_seqnr && (syntax_flags & HL_CONCEAL) != 0) if (((prev_syntax_id != syntax_seqnr && (syntax_flags & HL_CONCEAL) != 0)
|| has_match_conc > 1 || decor_conceal > 1) || has_match_conc > 1 || decor_conceal > 1)

View File

@ -1780,7 +1780,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
backspace_until_column(0); backspace_until_column(0);
// Insert new stuff into line again // Insert new stuff into line again
ins_bytes(new_line); ins_bytes((char *)new_line);
xfree(new_line); xfree(new_line);
@ -2595,7 +2595,7 @@ static void internal_format(int textwidth, int second_indent, int flags, int for
if (State & VREPLACE_FLAG) { if (State & VREPLACE_FLAG) {
// In MODE_VREPLACE state we have backspaced over the text to be // In MODE_VREPLACE state we have backspaced over the text to be
// moved, now we re-insert it into the new line. // moved, now we re-insert it into the new line.
ins_bytes(saved_text); ins_bytes((char *)saved_text);
xfree(saved_text); xfree(saved_text);
} else { } else {
/* /*
@ -3689,9 +3689,9 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
} }
if (*curbuf->b_p_inde != NUL) { if (*curbuf->b_p_inde != NUL) {
look = curbuf->b_p_indk; // 'indentexpr' set: use 'indentkeys' look = (char_u *)curbuf->b_p_indk; // 'indentexpr' set: use 'indentkeys'
} else { } else {
look = curbuf->b_p_cink; // 'indentexpr' empty: use 'cinkeys' look = (char_u *)curbuf->b_p_cink; // 'indentexpr' empty: use 'cinkeys'
} }
while (*look) { while (*look) {
/* /*

View File

@ -2192,7 +2192,7 @@ int pattern_match(char *pat, char *text, bool ic)
// avoid 'l' flag in 'cpoptions' // avoid 'l' flag in 'cpoptions'
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
if (regmatch.regprog != NULL) { if (regmatch.regprog != NULL) {
regmatch.rm_ic = ic; regmatch.rm_ic = ic;
@ -8326,7 +8326,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, char *flags
// Make 'cpoptions' empty, so that the 'l' flag doesn't work here // Make 'cpoptions' empty, so that the 'l' flag doesn't work here
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
ga_init(&ga, 1, 200); ga_init(&ga, 1, 200);
@ -8386,7 +8386,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, char *flags
char *ret = xstrdup(ga.ga_data == NULL ? str : ga.ga_data); char *ret = xstrdup(ga.ga_data == NULL ? str : ga.ga_data);
ga_clear(&ga); ga_clear(&ga);
if ((char_u *)p_cpo == empty_option) { if (p_cpo == empty_option) {
p_cpo = save_cpo; p_cpo = save_cpo;
} else { } else {
// Darn, evaluating {sub} expression or {expr} changed the value. // Darn, evaluating {sub} expression or {expr} changed the value.
@ -8395,7 +8395,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, char *flags
if (*p_cpo == NUL) { if (*p_cpo == NUL) {
set_option_value_give_err("cpo", 0L, save_cpo, 0); set_option_value_give_err("cpo", 0L, save_cpo, 0);
} }
free_string_option((char_u *)save_cpo); free_string_option(save_cpo);
} }
return ret; return ret;

View File

@ -591,7 +591,7 @@ buf_T *tv_get_buf(typval_T *tv, int curtab_only)
int save_magic = p_magic; int save_magic = p_magic;
p_magic = true; p_magic = true;
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
buf_T *buf = buflist_findnr(buflist_findpat((char *)name, (char *)name + STRLEN(name), buf_T *buf = buflist_findnr(buflist_findpat((char *)name, (char *)name + STRLEN(name),
true, false, curtab_only)); true, false, curtab_only));
@ -2224,7 +2224,7 @@ static void f_filewritable(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what) static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
{ {
char_u *fresult = NULL; char_u *fresult = NULL;
char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; char_u *path = *curbuf->b_p_path == NUL ? p_path : (char_u *)curbuf->b_p_path;
int count = 1; int count = 1;
bool first = true; bool first = true;
bool error = false; bool error = false;
@ -2265,7 +2265,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
find_what, (char_u *)curbuf->b_ffname, find_what, (char_u *)curbuf->b_ffname,
(find_what == FINDFILE_DIR (find_what == FINDFILE_DIR
? (char_u *)"" ? (char_u *)""
: curbuf->b_p_sua)); : (char_u *)curbuf->b_p_sua));
first = false; first = false;
if (fresult != NULL && rettv->v_type == VAR_LIST) { if (fresult != NULL && rettv->v_type == VAR_LIST) {
@ -4903,7 +4903,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
// Make 'cpoptions' empty, the 'l' flag should not be used here. // Make 'cpoptions' empty, the 'l' flag should not be used here.
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
switch (type) { switch (type) {
@ -6312,7 +6312,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
v = os_realpath(fname, v); v = os_realpath(fname, v);
} }
} }
rettv->vval.v_string = (char_u *)(v == NULL ? xstrdup(fname) : v); rettv->vval.v_string = (v == NULL ? xstrdup(fname) : v);
#else #else
# ifdef HAVE_READLINK # ifdef HAVE_READLINK
{ {
@ -7293,7 +7293,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
// Make 'cpoptions' empty, the 'l' flag should not be used here. // Make 'cpoptions' empty, the 'l' flag should not be used here.
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
// Set the time limit, if there is one. // Set the time limit, if there is one.
proftime_T tm = profile_setlimit(time_limit); proftime_T tm = profile_setlimit(time_limit);
@ -7419,7 +7419,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
xfree(pat2); xfree(pat2);
xfree(pat3); xfree(pat3);
if ((char_u *)p_cpo == empty_option) { if (p_cpo == empty_option) {
p_cpo = save_cpo; p_cpo = save_cpo;
} else { } else {
// Darn, evaluating the {skip} expression changed the value. // Darn, evaluating the {skip} expression changed the value.
@ -7428,7 +7428,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
if (*p_cpo == NUL) { if (*p_cpo == NUL) {
set_option_value_give_err("cpo", 0L, save_cpo, 0); set_option_value_give_err("cpo", 0L, save_cpo, 0);
} }
free_string_option((char_u *)save_cpo); free_string_option(save_cpo);
} }
return retval; return retval;
@ -8182,7 +8182,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
// Make 'cpoptions' empty, the 'l' flag should not be used here. // Make 'cpoptions' empty, the 'l' flag should not be used here.
char *save_cpo = p_cpo; char *save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
const char *str = tv_get_string(&argvars[0]); const char *str = tv_get_string(&argvars[0]);
const char *pat = NULL; const char *pat = NULL;

View File

@ -680,11 +680,11 @@ void ex_listdo(exarg_T *eap)
// buffer was opened while Syntax autocommands were disabled, // buffer was opened while Syntax autocommands were disabled,
// need to trigger them now. // need to trigger them now.
if (buf == curbuf) { if (buf == curbuf) {
apply_autocmds(EVENT_SYNTAX, (char *)curbuf->b_p_syn, curbuf->b_fname, true, apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname, true,
curbuf); curbuf);
} else { } else {
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
apply_autocmds(EVENT_SYNTAX, (char *)buf->b_p_syn, buf->b_fname, true, buf); apply_autocmds(EVENT_SYNTAX, buf->b_p_syn, buf->b_fname, true, buf);
aucmd_restbuf(&aco); aucmd_restbuf(&aco);
} }

View File

@ -2602,7 +2602,7 @@ void undo_cmdmod(cmdmod_T *cmod)
if (cmod->cmod_save_ei != NULL) { if (cmod->cmod_save_ei != NULL) {
// Restore 'eventignore' to the value before ":noautocmd". // Restore 'eventignore' to the value before ":noautocmd".
set_string_option_direct("ei", -1, cmod->cmod_save_ei, OPT_FREE, SID_NONE); set_string_option_direct("ei", -1, cmod->cmod_save_ei, OPT_FREE, SID_NONE);
free_string_option((char_u *)cmod->cmod_save_ei); free_string_option(cmod->cmod_save_ei);
cmod->cmod_save_ei = NULL; cmod->cmod_save_ei = NULL;
} }
@ -3646,8 +3646,8 @@ char *replace_makeprg(exarg_T *eap, char *arg, char **cmdlinep)
// Don't do it when ":vimgrep" is used for ":grep". // Don't do it when ":vimgrep" is used for ":grep".
if ((eap->cmdidx == CMD_make || eap->cmdidx == CMD_lmake || isgrep) if ((eap->cmdidx == CMD_make || eap->cmdidx == CMD_lmake || isgrep)
&& !grep_internal(eap->cmdidx)) { && !grep_internal(eap->cmdidx)) {
const char *program = isgrep ? (*curbuf->b_p_gp == NUL ? (char *)p_gp : (char *)curbuf->b_p_gp) const char *program = isgrep ? (*curbuf->b_p_gp == NUL ? (char *)p_gp : curbuf->b_p_gp)
: (*curbuf->b_p_mp == NUL ? (char *)p_mp : (char *)curbuf->b_p_mp); : (*curbuf->b_p_mp == NUL ? (char *)p_mp : curbuf->b_p_mp);
arg = skipwhite(arg); arg = skipwhite(arg);

View File

@ -1376,7 +1376,7 @@ void ex_catch(exarg_T *eap)
*end = NUL; *end = NUL;
} }
save_cpo = p_cpo; save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
// Disable error messages, it will make current exception // Disable error messages, it will make current exception
// invalid // invalid
emsg_off++; emsg_off++;

View File

@ -359,7 +359,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
// Then ":help" will re-use both the buffer and the window and set // Then ":help" will re-use both the buffer and the window and set
// the options, even when "options" is not in 'sessionoptions'. // the options, even when "options" is not in 'sessionoptions'.
if (0 < wp->w_tagstackidx && wp->w_tagstackidx <= wp->w_tagstacklen) { if (0 < wp->w_tagstackidx && wp->w_tagstackidx <= wp->w_tagstacklen) {
curtag = (char *)wp->w_tagstack[wp->w_tagstackidx - 1].tagname; curtag = wp->w_tagstack[wp->w_tagstackidx - 1].tagname;
} }
if (put_line(fd, "enew | setl bt=help") == FAIL if (put_line(fd, "enew | setl bt=help") == FAIL

View File

@ -827,7 +827,7 @@ char_u *vim_findfile(void *search_ctx_arg)
if (search_ctx->ffsc_tagfile) { if (search_ctx->ffsc_tagfile) {
suf = ""; suf = "";
} else { } else {
suf = (char *)curbuf->b_p_sua; suf = curbuf->b_p_sua;
} }
for (;;) { for (;;) {
// if file exists and we didn't already find it // if file exists and we didn't already find it
@ -1355,8 +1355,8 @@ char_u *find_file_in_path(char_u *ptr, size_t len, int options, int first, char_
return find_file_in_path_option(ptr, len, options, first, return find_file_in_path_option(ptr, len, options, first,
(*curbuf->b_p_path == NUL (*curbuf->b_p_path == NUL
? p_path ? p_path
: curbuf->b_p_path), : (char_u *)curbuf->b_p_path),
FINDFILE_BOTH, rel_fname, curbuf->b_p_sua); FINDFILE_BOTH, rel_fname, (char_u *)curbuf->b_p_sua);
} }
static char_u *ff_file_to_find = NULL; static char_u *ff_file_to_find = NULL;

View File

@ -708,7 +708,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
fenc_alloced = false; fenc_alloced = false;
} else if (*p_fencs == NUL) { } else if (*p_fencs == NUL) {
fenc = (char *)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 = (char *)p_fencs; // try items in 'fileencodings'
@ -1948,7 +1948,7 @@ failed:
if (!au_did_filetype && *curbuf->b_p_ft != NUL) { if (!au_did_filetype && *curbuf->b_p_ft != NUL) {
// EVENT_FILETYPE was not triggered but the buffer already has a // EVENT_FILETYPE was not triggered but the buffer already has a
// filetype. Trigger EVENT_FILETYPE using the existing filetype. // filetype. Trigger EVENT_FILETYPE using the existing filetype.
apply_autocmds(EVENT_FILETYPE, (char *)curbuf->b_p_ft, curbuf->b_fname, true, curbuf); apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname, true, curbuf);
} }
} else { } else {
apply_autocmds_exarg(EVENT_FILEREADPOST, sfname, sfname, apply_autocmds_exarg(EVENT_FILEREADPOST, sfname, sfname,
@ -3052,7 +3052,7 @@ nobackup:
fenc = (char *)enc_canonize((char_u *)fenc); fenc = (char *)enc_canonize((char_u *)fenc);
fenc_tofree = fenc; fenc_tofree = fenc;
} else { } else {
fenc = (char *)buf->b_p_fenc; fenc = buf->b_p_fenc;
} }
// Check if the file needs to be converted. // Check if the file needs to be converted.

View File

@ -1556,7 +1556,7 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
} }
parseMarker(wp); parseMarker(wp);
foldAddMarker(buf, start, wp->w_p_fmr, foldstartmarkerlen); foldAddMarker(buf, start, (char_u *)wp->w_p_fmr, foldstartmarkerlen);
foldAddMarker(buf, end, foldendmarker, foldendmarkerlen); foldAddMarker(buf, end, foldendmarker, foldendmarkerlen);
// Update both changes here, to avoid all folds after the start are // Update both changes here, to avoid all folds after the start are
@ -1575,9 +1575,9 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
/// Add "marker[markerlen]" in 'commentstring' to position `pos`. /// Add "marker[markerlen]" in 'commentstring' to position `pos`.
static void foldAddMarker(buf_T *buf, pos_T pos, const char_u *marker, size_t markerlen) static void foldAddMarker(buf_T *buf, pos_T pos, const char_u *marker, size_t markerlen)
{ {
char_u *cms = buf->b_p_cms; char_u *cms = (char_u *)buf->b_p_cms;
char_u *newline; char_u *newline;
char_u *p = (char_u *)strstr((char *)buf->b_p_cms, "%s"); char_u *p = (char_u *)strstr(buf->b_p_cms, "%s");
bool line_is_comment = false; bool line_is_comment = false;
linenr_T lnum = pos.lnum; linenr_T lnum = pos.lnum;
@ -1621,7 +1621,7 @@ static void deleteFoldMarkers(win_T *wp, fold_T *fp, int recursive, linenr_T lnu
lnum_off + fp->fd_top); lnum_off + fp->fd_top);
} }
} }
foldDelMarker(wp->w_buffer, fp->fd_top + lnum_off, wp->w_p_fmr, foldDelMarker(wp->w_buffer, fp->fd_top + lnum_off, (char_u *)wp->w_p_fmr,
foldstartmarkerlen); foldstartmarkerlen);
foldDelMarker(wp->w_buffer, fp->fd_top + lnum_off + fp->fd_len - 1, foldDelMarker(wp->w_buffer, fp->fd_top + lnum_off + fp->fd_len - 1,
foldendmarker, foldendmarkerlen); foldendmarker, foldendmarkerlen);
@ -1639,7 +1639,7 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char_u *marker, size_t mark
return; return;
} }
char_u *cms = buf->b_p_cms; char_u *cms = (char_u *)buf->b_p_cms;
char_u *line = ml_get_buf(buf, lnum, false); char_u *line = ml_get_buf(buf, lnum, false);
for (char_u *p = line; *p != NUL; p++) { for (char_u *p = line; *p != NUL; p++) {
if (STRNCMP(p, marker, markerlen) != 0) { if (STRNCMP(p, marker, markerlen) != 0) {
@ -1729,7 +1729,7 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldin
emsg_silent++; // handle exceptions, but don't display errors emsg_silent++; // handle exceptions, but don't display errors
text = text =
(char_u *)eval_to_string_safe((char *)wp->w_p_fdt, NULL, (char_u *)eval_to_string_safe(wp->w_p_fdt, NULL,
was_set_insecurely(wp, "foldtext", OPT_LOCAL)); was_set_insecurely(wp, "foldtext", OPT_LOCAL));
emsg_silent--; emsg_silent--;
@ -1790,7 +1790,7 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldin
static void foldtext_cleanup(char_u *str) static void foldtext_cleanup(char_u *str)
{ {
// Ignore leading and trailing white space in 'commentstring'. // Ignore leading and trailing white space in 'commentstring'.
char_u *cms_start = (char_u *)skipwhite((char *)curbuf->b_p_cms); char_u *cms_start = (char_u *)skipwhite(curbuf->b_p_cms);
size_t cms_slen = STRLEN(cms_start); size_t cms_slen = STRLEN(cms_start);
while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1])) { while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1])) {
cms_slen--; cms_slen--;
@ -2854,7 +2854,7 @@ static void foldlevelIndent(fline_T *flp)
// empty line or lines starting with a character in 'foldignore': level // empty line or lines starting with a character in 'foldignore': level
// depends on surrounding lines // depends on surrounding lines
if (*s == NUL || vim_strchr((char *)flp->wp->w_p_fdi, *s) != NULL) { if (*s == NUL || vim_strchr(flp->wp->w_p_fdi, *s) != NULL) {
// first and last line can't be undefined, use level 0 // first and last line can't be undefined, use level 0
if (lnum == 1 || lnum == buf->b_ml.ml_line_count) { if (lnum == 1 || lnum == buf->b_ml.ml_line_count) {
flp->lvl = 0; flp->lvl = 0;
@ -2907,7 +2907,7 @@ static void foldlevelExpr(fline_T *flp)
const bool save_keytyped = KeyTyped; const bool save_keytyped = KeyTyped;
int c; int c;
const int n = eval_foldexpr((char *)flp->wp->w_p_fde, &c); const int n = eval_foldexpr(flp->wp->w_p_fde, &c);
KeyTyped = save_keytyped; KeyTyped = save_keytyped;
switch (c) { switch (c) {
@ -2985,8 +2985,8 @@ static void foldlevelExpr(fline_T *flp)
/// Relies on the option value to have been checked for correctness already. /// Relies on the option value to have been checked for correctness already.
static void parseMarker(win_T *wp) static void parseMarker(win_T *wp)
{ {
foldendmarker = (char_u *)vim_strchr((char *)wp->w_p_fmr, ','); foldendmarker = (char_u *)vim_strchr(wp->w_p_fmr, ',');
foldstartmarkerlen = (size_t)(foldendmarker++ - wp->w_p_fmr); foldstartmarkerlen = (size_t)(foldendmarker++ - (char_u *)wp->w_p_fmr);
foldendmarkerlen = STRLEN(foldendmarker); foldendmarkerlen = STRLEN(foldendmarker);
} }
@ -3003,7 +3003,7 @@ static void foldlevelMarker(fline_T *flp)
int start_lvl = flp->lvl; int start_lvl = flp->lvl;
// cache a few values for speed // cache a few values for speed
char_u *startmarker = flp->wp->w_p_fmr; char_u *startmarker = (char_u *)flp->wp->w_p_fmr;
int cstart = *startmarker; int cstart = *startmarker;
startmarker++; startmarker++;
int cend = *foldendmarker; int cend = *foldendmarker;

View File

@ -162,7 +162,7 @@ static char_u *get_buffcont(buffheader_T *buffer, int dozero)
p2 = p; p2 = p;
for (const buffblock_T *bp = buffer->bh_first.b_next; for (const buffblock_T *bp = buffer->bh_first.b_next;
bp != NULL; bp = bp->b_next) { bp != NULL; bp = bp->b_next) {
for (const char_u *str = bp->b_str; *str;) { for (const char_u *str = (char_u *)bp->b_str; *str;) {
*p2++ = *str++; *p2++ = *str++;
} }
} }
@ -341,7 +341,7 @@ static int read_readbuf(buffheader_T *buf, int advance)
} }
buffblock_T *const curr = buf->bh_first.b_next; buffblock_T *const curr = buf->bh_first.b_next;
c = curr->b_str[buf->bh_index]; c = (char_u)curr->b_str[buf->bh_index];
if (advance) { if (advance) {
if (curr->b_str[++buf->bh_index] == NUL) { if (curr->b_str[++buf->bh_index] == NUL) {
@ -649,7 +649,7 @@ static int read_redo(bool init, bool old_redo)
if (bp == NULL) { if (bp == NULL) {
return FAIL; return FAIL;
} }
p = bp->b_str; p = (char_u *)bp->b_str;
return OK; return OK;
} }
if ((c = *p) == NUL) { if ((c = *p) == NUL) {
@ -670,7 +670,7 @@ static int read_redo(bool init, bool old_redo)
} }
if (*++p == NUL && bp->b_next != NULL) { if (*++p == NUL && bp->b_next != NULL) {
bp = bp->b_next; bp = bp->b_next;
p = bp->b_str; p = (char_u *)bp->b_str;
} }
buf[i] = (char_u)c; buf[i] = (char_u)c;
if (i == n - 1) { // last byte of a character if (i == n - 1) { // last byte of a character
@ -934,7 +934,7 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
} }
for (i = 0; i < addlen; i++) { for (i = 0; i < addlen; i++) {
typebuf.tb_noremap[typebuf.tb_off + i + offset] = typebuf.tb_noremap[typebuf.tb_off + i + offset] =
(char_u)((--nrm >= 0) ? val : RM_YES); (uint8_t)((--nrm >= 0) ? val : RM_YES);
} }
// tb_maplen and tb_silent only remember the length of mapped and/or // tb_maplen and tb_silent only remember the length of mapped and/or
@ -2047,12 +2047,11 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// - Partly match: mlen == typebuf.tb_len // - Partly match: mlen == typebuf.tb_len
keylen = mp->m_keylen; keylen = mp->m_keylen;
if (mlen == keylen || (mlen == typebuf.tb_len && typebuf.tb_len < keylen)) { if (mlen == keylen || (mlen == typebuf.tb_len && typebuf.tb_len < keylen)) {
char_u *s;
int n; int n;
// If only script-local mappings are allowed, check if the // If only script-local mappings are allowed, check if the
// mapping starts with K_SNR. // mapping starts with K_SNR.
s = typebuf.tb_noremap + typebuf.tb_off; uint8_t *s = typebuf.tb_noremap + typebuf.tb_off;
if (*s == RM_SCRIPT if (*s == RM_SCRIPT
&& (mp->m_keys[0] != K_SPECIAL && (mp->m_keys[0] != K_SPECIAL
|| mp->m_keys[1] != KS_EXTRA || mp->m_keys[1] != KS_EXTRA
@ -2248,7 +2247,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
save_m_keys = vim_strsave(mp->m_keys); save_m_keys = vim_strsave(mp->m_keys);
if (save_m_luaref == LUA_NOREF) { if (save_m_luaref == LUA_NOREF) {
save_m_str = vim_strsave(mp->m_str); save_m_str = vim_strsave((char_u *)mp->m_str);
} }
map_str = eval_map_expr(mp, NUL); map_str = eval_map_expr(mp, NUL);
@ -2280,7 +2279,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
vgetc_busy = save_vgetc_busy; vgetc_busy = save_vgetc_busy;
may_garbage_collect = save_may_garbage_collect; may_garbage_collect = save_may_garbage_collect;
} else { } else {
map_str = mp->m_str; map_str = (char_u *)mp->m_str;
} }
// Insert the 'to' part in the typebuf.tb_buf. // Insert the 'to' part in the typebuf.tb_buf.
@ -2501,7 +2500,7 @@ static int vgetorpeek(bool advance)
// write char to script file(s) // write char to script file(s)
gotchars(typebuf.tb_buf + typebuf.tb_off, 1); gotchars(typebuf.tb_buf + typebuf.tb_off, 1);
} }
KeyNoremap = typebuf.tb_noremap[typebuf.tb_off]; KeyNoremap = (unsigned char)typebuf.tb_noremap[typebuf.tb_off];
del_typebuf(1, 0); del_typebuf(1, 0);
} }
break; // got character, break the for loop break; // got character, break the for loop

View File

@ -755,7 +755,7 @@ EXTERN int keep_help_flag INIT(= false); // doing :ta from help file
// When a string option is NULL (which only happens in out-of-memory // When a string option is NULL (which only happens in out-of-memory
// situations), it is set to empty_option, to avoid having to check for NULL // situations), it is set to empty_option, to avoid having to check for NULL
// everywhere. // everywhere.
EXTERN char_u *empty_option INIT(= (char_u *)""); EXTERN char *empty_option INIT(= "");
EXTERN bool redir_off INIT(= false); // no redirection for a moment EXTERN bool redir_off INIT(= false); // no redirection for a moment
EXTERN FILE *redir_fd INIT(= NULL); // message redirection file EXTERN FILE *redir_fd INIT(= NULL); // message redirection file

View File

@ -710,7 +710,7 @@ int get_number_indent(linenr_T lnum)
if ((State & MODE_INSERT) || has_format_option(FO_Q_COMS)) { if ((State & MODE_INSERT) || has_format_option(FO_Q_COMS)) {
lead_len = get_leader_len((char *)ml_get(lnum), NULL, false, true); lead_len = get_leader_len((char *)ml_get(lnum), NULL, false, true);
} }
regmatch.regprog = vim_regcomp((char *)curbuf->b_p_flp, RE_MAGIC); regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL) { if (regmatch.regprog != NULL) {
regmatch.rm_ic = false; regmatch.rm_ic = false;
@ -770,7 +770,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
// add additional indent for numbered lists // add additional indent for numbered lists
if (wp->w_briopt_list != 0) { if (wp->w_briopt_list != 0) {
regmatch_T regmatch = { regmatch_T regmatch = {
.regprog = vim_regcomp((char *)curbuf->b_p_flp, .regprog = vim_regcomp(curbuf->b_p_flp,
RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT), RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT),
}; };
@ -855,7 +855,7 @@ int get_expr_indent(void)
// Need to make a copy, the 'indentexpr' option could be changed while // Need to make a copy, the 'indentexpr' option could be changed while
// evaluating it. // evaluating it.
char_u *inde_copy = vim_strsave(curbuf->b_p_inde); char_u *inde_copy = vim_strsave((char_u *)curbuf->b_p_inde);
indent = (int)eval_to_number((char *)inde_copy); indent = (int)eval_to_number((char *)inde_copy);
xfree(inde_copy); xfree(inde_copy);
@ -1077,7 +1077,7 @@ static int lisp_match(char_u *p)
{ {
char_u buf[LSIZE]; char_u buf[LSIZE];
int len; int len;
char *word = (char *)(*curbuf->b_p_lw != NUL ? curbuf->b_p_lw : p_lispwords); char *word = (char *)(*curbuf->b_p_lw != NUL ? (char_u *)curbuf->b_p_lw : p_lispwords);
while (*word != NUL) { while (*word != NUL) {
(void)copy_option_part(&word, (char *)buf, LSIZE, ","); (void)copy_option_part(&word, (char *)buf, LSIZE, ",");

View File

@ -223,7 +223,7 @@ bool cin_is_cinword(const char_u *line)
char_u *cinw_buf = xmalloc(cinw_len); char_u *cinw_buf = xmalloc(cinw_len);
line = (char_u *)skipwhite((char *)line); line = (char_u *)skipwhite((char *)line);
for (char *cinw = (char *)curbuf->b_p_cinw; *cinw;) { for (char *cinw = curbuf->b_p_cinw; *cinw;) {
size_t len = copy_option_part(&cinw, (char *)cinw_buf, cinw_len, ","); size_t len = copy_option_part(&cinw, (char *)cinw_buf, cinw_len, ",");
if (STRNCMP(line, cinw_buf, len) == 0 if (STRNCMP(line, cinw_buf, len) == 0
&& (!vim_iswordc(line[len]) || !vim_iswordc(line[len - 1]))) { && (!vim_iswordc(line[len]) || !vim_iswordc(line[len - 1]))) {
@ -519,7 +519,7 @@ bool cin_isscopedecl(const char_u *p)
bool found = false; bool found = false;
for (char *cinsd = (char *)curbuf->b_p_cinsd; *cinsd;) { for (char *cinsd = curbuf->b_p_cinsd; *cinsd;) {
const size_t len = copy_option_part(&cinsd, (char *)cinsd_buf, cinsd_len, ","); const size_t len = copy_option_part(&cinsd, (char *)cinsd_buf, cinsd_len, ",");
if (STRNCMP(s, cinsd_buf, len) == 0) { if (STRNCMP(s, cinsd_buf, len) == 0) {
const char_u *skip = cin_skipcomment(s + len); const char_u *skip = cin_skipcomment(s + len);
@ -1740,7 +1740,7 @@ void parse_cino(buf_T *buf)
// Handle C #pragma directives // Handle C #pragma directives
buf->b_ind_pragma = 0; buf->b_ind_pragma = 0;
for (p = (char *)buf->b_p_cino; *p;) { for (p = buf->b_p_cino; *p;) {
l = p++; l = p++;
if (*p == '-') { if (*p == '-') {
p++; p++;
@ -2063,7 +2063,7 @@ int get_c_indent(void)
*lead_start = NUL; *lead_start = NUL;
*lead_middle = NUL; *lead_middle = NUL;
p = (char *)curbuf->b_p_com; p = curbuf->b_p_com;
while (*p != NUL) { while (*p != NUL) {
int align = 0; int align = 0;
int off = 0; int off = 0;

View File

@ -901,7 +901,7 @@ static void ins_compl_longest_match(compl_T *match)
had_match = (curwin->w_cursor.col > compl_col); had_match = (curwin->w_cursor.col > compl_col);
ins_compl_delete(); ins_compl_delete();
ins_bytes(compl_leader + get_compl_len()); ins_bytes((char *)compl_leader + get_compl_len());
ins_redraw(false); ins_redraw(false);
// When the match isn't there (to avoid matching itself) remove it // When the match isn't there (to avoid matching itself) remove it
@ -935,7 +935,7 @@ static void ins_compl_longest_match(compl_T *match)
*p = NUL; *p = NUL;
had_match = (curwin->w_cursor.col > compl_col); had_match = (curwin->w_cursor.col > compl_col);
ins_compl_delete(); ins_compl_delete();
ins_bytes(compl_leader + get_compl_len()); ins_bytes((char *)compl_leader + get_compl_len());
ins_redraw(false); ins_redraw(false);
// When the match isn't there (to avoid matching itself) remove it // When the match isn't there (to avoid matching itself) remove it
@ -1677,7 +1677,7 @@ static void ins_compl_new_leader(void)
{ {
ins_compl_del_pum(); ins_compl_del_pum();
ins_compl_delete(); ins_compl_delete();
ins_bytes(compl_leader + get_compl_len()); ins_bytes((char *)compl_leader + get_compl_len());
compl_used_match = false; compl_used_match = false;
if (compl_started) { if (compl_started) {
@ -2224,11 +2224,11 @@ static char_u *get_complete_funcname(int type)
{ {
switch (type) { switch (type) {
case CTRL_X_FUNCTION: case CTRL_X_FUNCTION:
return curbuf->b_p_cfu; return (char_u *)curbuf->b_p_cfu;
case CTRL_X_OMNI: case CTRL_X_OMNI:
return 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 : curbuf->b_p_tsrfu; return *curbuf->b_p_tsrfu == NUL ? p_tsrfu : (char_u *)curbuf->b_p_tsrfu;
default: default:
return (char_u *)""; return (char_u *)"";
} }
@ -2823,8 +2823,8 @@ static void get_next_dict_tsr_completion(int compl_type, char_u *dict, int dict_
} else { } else {
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 : curbuf->b_p_tsr) ? (*curbuf->b_p_tsr == NUL ? p_tsr : (char_u *)curbuf->b_p_tsr)
: (*curbuf->b_p_dict == NUL ? p_dict : curbuf->b_p_dict)), : (*curbuf->b_p_dict == NUL ? 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);
@ -3174,7 +3174,7 @@ static int ins_compl_get_exp(pos_T *ini)
} }
st.found_all = false; st.found_all = false;
st.ins_buf = curbuf; st.ins_buf = curbuf;
st.e_cpt = (compl_cont_status & CONT_LOCAL) ? "." : (char *)curbuf->b_p_cpt; st.e_cpt = (compl_cont_status & CONT_LOCAL) ? "." : curbuf->b_p_cpt;
st.last_match_pos = st.first_match_pos = *ini; st.last_match_pos = st.first_match_pos = *ini;
} else if (st.ins_buf != curbuf && !buf_valid(st.ins_buf)) { } else if (st.ins_buf != curbuf && !buf_valid(st.ins_buf)) {
st.ins_buf = curbuf; // In case the buffer was wiped out. st.ins_buf = curbuf; // In case the buffer was wiped out.
@ -3319,7 +3319,7 @@ void ins_compl_delete(void)
/// "in_compl_func" is true when called from complete_check(). /// "in_compl_func" is true when called from complete_check().
void ins_compl_insert(bool in_compl_func) void ins_compl_insert(bool in_compl_func)
{ {
ins_bytes(compl_shown_match->cp_str + get_compl_len()); ins_bytes((char *)compl_shown_match->cp_str + get_compl_len());
compl_used_match = !match_at_original_text(compl_shown_match); compl_used_match = !match_at_original_text(compl_shown_match);
dict_T *dict = ins_compl_dict_alloc(compl_shown_match); dict_T *dict = ins_compl_dict_alloc(compl_shown_match);
@ -3511,13 +3511,13 @@ static int ins_compl_next(bool allow_get_expansion, int count, bool insert_match
// Insert the text of the new completion, or the compl_leader. // Insert the text of the new completion, or the compl_leader.
if (compl_no_insert && !started) { if (compl_no_insert && !started) {
ins_bytes(compl_orig_text + get_compl_len()); ins_bytes((char *)compl_orig_text + get_compl_len());
compl_used_match = false; compl_used_match = false;
} else if (insert_match) { } else if (insert_match) {
if (!compl_get_longest || compl_used_match) { if (!compl_get_longest || compl_used_match) {
ins_compl_insert(in_compl_func); ins_compl_insert(in_compl_func);
} else { } else {
ins_bytes(compl_leader + get_compl_len()); ins_bytes((char *)compl_leader + get_compl_len());
} }
} else { } else {
compl_used_match = false; compl_used_match = false;
@ -4079,9 +4079,9 @@ static int ins_compl_start(void)
edit_submode_pre = (char_u *)_(" Adding"); edit_submode_pre = (char_u *)_(" Adding");
if (ctrl_x_mode_line_or_eval()) { if (ctrl_x_mode_line_or_eval()) {
// Insert a new line, keep indentation but ignore 'comments'. // Insert a new line, keep indentation but ignore 'comments'.
char_u *old = curbuf->b_p_com; char *old = curbuf->b_p_com;
curbuf->b_p_com = (char_u *)""; curbuf->b_p_com = "";
compl_startpos.lnum = curwin->w_cursor.lnum; compl_startpos.lnum = curwin->w_cursor.lnum;
compl_startpos.col = compl_col; compl_startpos.col = compl_col;
ins_eol('\r'); ins_eol('\r');

View File

@ -990,7 +990,7 @@ int nlua_in_fast_event(lua_State *lstate)
static bool viml_func_is_fast(const char *name) static bool viml_func_is_fast(const char *name)
{ {
const EvalFuncDef *const fdef = find_internal_func((const char *)name); const EvalFuncDef *const fdef = find_internal_func(name);
if (fdef) { if (fdef) {
return fdef->fast; return fdef->fast;
} }

View File

@ -150,7 +150,7 @@ static void showmap(mapblock_T *mp, bool local)
{ {
size_t len = 1; size_t len = 1;
if (message_filtered(mp->m_keys) && message_filtered(mp->m_str) if (message_filtered(mp->m_keys) && message_filtered((char_u *)mp->m_str)
&& (mp->m_desc == NULL || message_filtered((char_u *)mp->m_desc))) { && (mp->m_desc == NULL || message_filtered((char_u *)mp->m_desc))) {
return; return;
} }
@ -203,7 +203,7 @@ static void showmap(mapblock_T *mp, bool local)
} else if (mp->m_str[0] == NUL) { } else if (mp->m_str[0] == NUL) {
msg_puts_attr("<Nop>", HL_ATTR(HLF_8)); msg_puts_attr("<Nop>", HL_ATTR(HLF_8));
} else { } else {
msg_outtrans_special(mp->m_str, false, 0); msg_outtrans_special((char_u *)mp->m_str, false, 0);
} }
if (mp->m_desc != NULL) { if (mp->m_desc != NULL) {
@ -449,8 +449,8 @@ static void map_add(buf_T *buf, mapblock_T **map_table, mapblock_T **abbr_table,
} }
mp->m_keys = vim_strsave(keys); mp->m_keys = vim_strsave(keys);
mp->m_str = args->rhs; mp->m_str = (char *)args->rhs;
mp->m_orig_str = args->orig_rhs; mp->m_orig_str = (char *)args->orig_rhs;
mp->m_luaref = args->rhs_lua; mp->m_luaref = args->rhs_lua;
if (!simplified) { if (!simplified) {
args->rhs = NULL; args->rhs = NULL;
@ -704,7 +704,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
} else { // do we have a match? } else { // do we have a match?
if (round) { // second round: Try unmap "rhs" string if (round) { // second round: Try unmap "rhs" string
n = (int)STRLEN(mp->m_str); n = (int)STRLEN(mp->m_str);
p = mp->m_str; p = (char_u *)mp->m_str;
} else { } else {
n = mp->m_keylen; n = mp->m_keylen;
p = mp->m_keys; p = mp->m_keys;
@ -761,8 +761,8 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
XFREE_CLEAR(mp->m_str); XFREE_CLEAR(mp->m_str);
XFREE_CLEAR(mp->m_orig_str); XFREE_CLEAR(mp->m_orig_str);
} }
mp->m_str = args->rhs; mp->m_str = (char *)args->rhs;
mp->m_orig_str = args->orig_rhs; mp->m_orig_str = (char *)args->orig_rhs;
mp->m_luaref = args->rhs_lua; mp->m_luaref = args->rhs_lua;
if (!keyround1_simplified) { if (!keyround1_simplified) {
args->rhs = NULL; args->rhs = NULL;
@ -1113,7 +1113,7 @@ int map_to_exists_mode(const char *const rhs, const int mode, const bool abbr)
mp = maphash[hash]; mp = maphash[hash];
} }
for (; mp; mp = mp->m_next) { for (; mp; mp = mp->m_next) {
if ((mp->m_mode & mode) && strstr((char *)mp->m_str, rhs) != NULL) { if ((mp->m_mode & mode) && strstr(mp->m_str, rhs) != NULL) {
return true; return true;
} }
} }
@ -1506,7 +1506,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
if (mp->m_expr) { if (mp->m_expr) {
s = eval_map_expr(mp, c); s = eval_map_expr(mp, c);
} else { } else {
s = mp->m_str; s = (char_u *)mp->m_str;
} }
if (s != NULL) { if (s != NULL) {
// insert the to string // insert the to string
@ -1542,7 +1542,7 @@ char_u *eval_map_expr(mapblock_T *mp, int c)
// Remove escaping of K_SPECIAL, because "str" is in a format to be used as // Remove escaping of K_SPECIAL, because "str" is in a format to be used as
// typeahead. // typeahead.
if (mp->m_luaref == LUA_NOREF) { if (mp->m_luaref == LUA_NOREF) {
expr = vim_strsave(mp->m_str); expr = vim_strsave((char_u *)mp->m_str);
vim_unescape_ks(expr); vim_unescape_ks(expr);
} }
@ -1639,7 +1639,7 @@ int makemap(FILE *fd, buf_T *buf)
if (mp->m_luaref != LUA_NOREF) { if (mp->m_luaref != LUA_NOREF) {
continue; continue;
} }
for (p = mp->m_str; *p != NUL; p++) { for (p = (char_u *)mp->m_str; *p != NUL; p++) {
if (p[0] == K_SPECIAL && p[1] == KS_EXTRA if (p[0] == K_SPECIAL && p[1] == KS_EXTRA
&& p[2] == KE_SNR) { && p[2] == KE_SNR) {
break; break;
@ -1785,7 +1785,7 @@ int makemap(FILE *fd, buf_T *buf)
if (putc(' ', fd) < 0 if (putc(' ', fd) < 0
|| put_escstr(fd, mp->m_keys, 0) == FAIL || put_escstr(fd, mp->m_keys, 0) == FAIL
|| putc(' ', fd) < 0 || putc(' ', fd) < 0
|| put_escstr(fd, mp->m_str, 1) == FAIL || put_escstr(fd, (char_u *)mp->m_str, 1) == FAIL
|| put_eol(fd) < 0) { || put_eol(fd) < 0) {
return FAIL; return FAIL;
} }
@ -1956,7 +1956,7 @@ char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, mapb
*local_ptr = local; *local_ptr = local;
} }
*rhs_lua = mp->m_luaref; *rhs_lua = mp->m_luaref;
return mp->m_luaref == LUA_NOREF ? mp->m_str : NULL; return mp->m_luaref == LUA_NOREF ? (char_u *)mp->m_str : NULL;
} }
} }
} }

View File

@ -1932,11 +1932,11 @@ void utf_find_illegal(void)
char_u *tofree = NULL; char_u *tofree = NULL;
vimconv.vc_type = CONV_NONE; vimconv.vc_type = CONV_NONE;
if (enc_canon_props(curbuf->b_p_fenc) & ENC_8BIT) { if (enc_canon_props((char_u *)curbuf->b_p_fenc) & ENC_8BIT) {
// '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, curbuf->b_p_fenc); convert_setup(&vimconv, p_enc, (char_u *)curbuf->b_p_fenc);
} }
curwin->w_cursor.coladd = 0; curwin->w_cursor.coladd = 0;

View File

@ -721,7 +721,7 @@ static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf)
b0p->b0_flags &= (uint8_t) ~B0_HAS_FENC; b0p->b0_flags &= (uint8_t) ~B0_HAS_FENC;
} else { } else {
memmove((char *)b0p->b0_fname + size - n, memmove((char *)b0p->b0_fname + size - n,
(char *)buf->b_p_fenc, (size_t)n); buf->b_p_fenc, (size_t)n);
*(b0p->b0_fname + size - n - 1) = NUL; *(b0p->b0_fname + size - n - 1) = NUL;
b0p->b0_flags |= B0_HAS_FENC; b0p->b0_flags |= B0_HAS_FENC;
} }

View File

@ -216,7 +216,7 @@ bool server_stop(char *endpoint)
watchers.ga_len--; watchers.ga_len--;
// Bump v:servername to the next available server, if any. // Bump v:servername to the next available server, if any.
if (strequal(addr, (char *)get_vim_var_str(VV_SEND_SERVER))) { if (strequal(addr, get_vim_var_str(VV_SEND_SERVER))) {
set_vservername(&watchers); set_vservername(&watchers);
} }

View File

@ -2653,10 +2653,10 @@ void clear_showcmd(void)
if (VIsual_mode == Ctrl_V) { if (VIsual_mode == Ctrl_V) {
char_u *const saved_sbr = p_sbr; char_u *const saved_sbr = p_sbr;
char_u *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 = empty_option; p_sbr = (char_u *)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;
@ -4275,7 +4275,7 @@ static void nv_ident(cmdarg_T *cap)
// Allocate buffer to put the command in. Inserting backslashes can // Allocate buffer to put the command in. Inserting backslashes can
// double the length of the word. p_kp / curbuf->b_p_kp could be added // double the length of the word. p_kp / curbuf->b_p_kp could be added
// and some numbers. // and some numbers.
char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : curbuf->b_p_kp; // 'keywordprg' char_u *kp = *curbuf->b_p_kp == NUL ? p_kp : (char_u *)curbuf->b_p_kp; // 'keywordprg'
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty. assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0); bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
@ -7075,8 +7075,8 @@ static void nv_object(cmdarg_T *cap)
include = true; // "ax" = an object: include white space include = true; // "ax" = an object: include white space
} }
// Make sure (), [], {} and <> are in 'matchpairs' // Make sure (), [], {} and <> are in 'matchpairs'
mps_save = curbuf->b_p_mps; mps_save = (char_u *)curbuf->b_p_mps;
curbuf->b_p_mps = (char_u *)"(:),{:},[:],<:>"; curbuf->b_p_mps = "(:),{:},[:],<:>";
switch (cap->nchar) { switch (cap->nchar) {
case 'w': // "aw" = a word case 'w': // "aw" = a word
@ -7130,7 +7130,7 @@ static void nv_object(cmdarg_T *cap)
break; break;
} }
curbuf->b_p_mps = mps_save; curbuf->b_p_mps = (char *)mps_save;
if (!flag) { if (!flag) {
clearopbeep(cap->oap); clearopbeep(cap->oap);
} }

View File

@ -4385,23 +4385,20 @@ int fex_format(linenr_T lnum, long count, int c)
{ {
int use_sandbox = was_set_insecurely(curwin, "formatexpr", OPT_LOCAL); int use_sandbox = was_set_insecurely(curwin, "formatexpr", OPT_LOCAL);
int r; int r;
char_u *fex;
/* // Set v:lnum to the first line number and v:count to the number of lines.
* Set v:lnum to the first line number and v:count to the number of lines. // Set v:char to the character to be inserted (can be NUL).
* Set v:char to the character to be inserted (can be NUL).
*/
set_vim_var_nr(VV_LNUM, (varnumber_T)lnum); set_vim_var_nr(VV_LNUM, (varnumber_T)lnum);
set_vim_var_nr(VV_COUNT, (varnumber_T)count); set_vim_var_nr(VV_COUNT, (varnumber_T)count);
set_vim_var_char(c); set_vim_var_char(c);
// Make a copy, the option could be changed while calling it. // Make a copy, the option could be changed while calling it.
fex = vim_strsave(curbuf->b_p_fex); char *fex = xstrdup(curbuf->b_p_fex);
// Evaluate the function. // Evaluate the function.
if (use_sandbox) { if (use_sandbox) {
sandbox++; sandbox++;
} }
r = (int)eval_to_number((char *)fex); r = (int)eval_to_number(fex);
if (use_sandbox) { if (use_sandbox) {
sandbox--; sandbox--;
} }
@ -5008,12 +5005,12 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
pos_T endpos; pos_T endpos;
colnr_T save_coladd = 0; colnr_T save_coladd = 0;
const bool do_hex = vim_strchr((char *)curbuf->b_p_nf, 'x') != NULL; // "heX" const bool do_hex = vim_strchr(curbuf->b_p_nf, 'x') != NULL; // "heX"
const bool do_oct = vim_strchr((char *)curbuf->b_p_nf, 'o') != NULL; // "Octal" const bool do_oct = vim_strchr(curbuf->b_p_nf, 'o') != NULL; // "Octal"
const bool do_bin = vim_strchr((char *)curbuf->b_p_nf, 'b') != NULL; // "Bin" const bool do_bin = vim_strchr(curbuf->b_p_nf, 'b') != NULL; // "Bin"
const bool do_alpha = vim_strchr((char *)curbuf->b_p_nf, 'p') != NULL; // "alPha" const bool do_alpha = vim_strchr(curbuf->b_p_nf, 'p') != NULL; // "alPha"
// "Unsigned" // "Unsigned"
const bool do_unsigned = vim_strchr((char *)curbuf->b_p_nf, 'u') != NULL; const bool do_unsigned = vim_strchr(curbuf->b_p_nf, 'u') != NULL;
if (virtual_active()) { if (virtual_active()) {
save_coladd = pos->coladd; save_coladd = pos->coladd;
@ -5886,10 +5883,10 @@ 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_u *const saved_sbr = p_sbr;
char_u *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 = empty_option; p_sbr = (char_u *)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;

View File

@ -464,7 +464,7 @@ static void set_option_default(int opt_idx, int opt_flags)
(char *)options[opt_idx].def_val, opt_flags, 0); (char *)options[opt_idx].def_val, opt_flags, 0);
} else { } else {
if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) { if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) {
free_string_option(*(char_u **)(varp)); free_string_option(*(char **)(varp));
} }
*(char_u **)varp = options[opt_idx].def_val; *(char_u **)varp = options[opt_idx].def_val;
options[opt_idx].flags &= ~P_ALLOCED; options[opt_idx].flags &= ~P_ALLOCED;
@ -603,14 +603,14 @@ void free_all_options(void)
if (options[i].indir == PV_NONE) { if (options[i].indir == PV_NONE) {
// global option: free value and default value. // global option: free value and default value.
if ((options[i].flags & P_ALLOCED) && options[i].var != NULL) { if ((options[i].flags & P_ALLOCED) && options[i].var != NULL) {
free_string_option(*(char_u **)options[i].var); free_string_option(*(char **)options[i].var);
} }
if (options[i].flags & P_DEF_ALLOCED) { if (options[i].flags & P_DEF_ALLOCED) {
free_string_option(options[i].def_val); free_string_option((char *)options[i].def_val);
} }
} else if (options[i].var != VAR_WIN && (options[i].flags & P_STRING)) { } else if (options[i].var != VAR_WIN && (options[i].flags & P_STRING)) {
// buffer-local option: free global value // buffer-local option: free global value
clear_string_option((char_u **)options[i].var); clear_string_option((char **)options[i].var);
} }
} }
free_operatorfunc_option(); free_operatorfunc_option();
@ -730,7 +730,7 @@ void set_helplang_default(const char *lang)
int idx = findoption("hlg"); int idx = findoption("hlg");
if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) { if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) {
if (options[idx].flags & P_ALLOCED) { if (options[idx].flags & P_ALLOCED) {
free_string_option(p_hlg); free_string_option((char *)p_hlg);
} }
p_hlg = (char_u *)xmemdupz(lang, lang_len); p_hlg = (char_u *)xmemdupz(lang, lang_len);
// zh_CN becomes "cn", zh_TW becomes "tw". // zh_CN becomes "cn", zh_TW becomes "tw".
@ -1185,7 +1185,7 @@ int do_set(char *arg, int opt_flags)
// A global-local string option might have an empty // A global-local string option might have an empty
// option as value to indicate that the global // option as value to indicate that the global
// value should be used. // value should be used.
if (((int)options[opt_idx].indir & PV_BOTH) && origval_l == empty_option) { if (((int)options[opt_idx].indir & PV_BOTH) && origval_l == (char_u *)empty_option) {
origval_l = origval_g; origval_l = origval_g;
} }
} }
@ -1205,7 +1205,7 @@ int do_set(char *arg, int opt_flags)
// required when an environment variable was set // required when an environment variable was set
// later // later
if (newval == NULL) { if (newval == NULL) {
newval = empty_option; newval = (char_u *)empty_option;
} else if (!(options[opt_idx].flags & P_NO_DEF_EXP)) { } else if (!(options[opt_idx].flags & P_NO_DEF_EXP)) {
s = option_expand(opt_idx, newval); s = option_expand(opt_idx, newval);
if (s == NULL) { if (s == NULL) {
@ -1233,7 +1233,7 @@ int do_set(char *arg, int opt_flags)
i = getdigits_int((char **)varp, true, 0); i = getdigits_int((char **)varp, true, 0);
switch (i) { switch (i) {
case 0: case 0:
*(char_u **)varp = empty_option; *(char **)varp = empty_option;
break; break;
case 1: case 1:
*(char_u **)varp = vim_strsave((char_u *)"indent,eol"); *(char_u **)varp = vim_strsave((char_u *)"indent,eol");
@ -1797,17 +1797,17 @@ static void didset_options2(void)
highlight_changed(); highlight_changed();
// Parse default for 'fillchars'. // Parse default for 'fillchars'.
(void)set_chars_option(curwin, &curwin->w_p_fcs, true); (void)set_chars_option(curwin, (char_u **)&curwin->w_p_fcs, true);
// Parse default for 'listchars'. // Parse default for 'listchars'.
(void)set_chars_option(curwin, &curwin->w_p_lcs, true); (void)set_chars_option(curwin, (char_u **)&curwin->w_p_lcs, true);
// Parse default for 'wildmode'. // Parse default for 'wildmode'.
check_opt_wim(); check_opt_wim();
xfree(curbuf->b_p_vsts_array); xfree(curbuf->b_p_vsts_array);
(void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array); (void)tabstop_set((char_u *)curbuf->b_p_vsts, &curbuf->b_p_vsts_array);
xfree(curbuf->b_p_vts_array); xfree(curbuf->b_p_vts_array);
(void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array); (void)tabstop_set((char_u *)curbuf->b_p_vts, &curbuf->b_p_vts_array);
} }
/// Check for string options that are NULL (normally only termcap options). /// Check for string options that are NULL (normally only termcap options).
@ -1817,7 +1817,7 @@ void check_options(void)
for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) { for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) {
if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL) { if ((options[opt_idx].flags & P_STRING) && options[opt_idx].var != NULL) {
check_string_option((char_u **)get_varp(&(options[opt_idx]))); check_string_option((char **)get_varp(&(options[opt_idx])));
} }
} }
} }
@ -3597,12 +3597,12 @@ int makeset(FILE *fd, int opt_flags, int local_only)
/// 'sessionoptions' or 'viewoptions' contains "folds" but not "options". /// 'sessionoptions' or 'viewoptions' contains "folds" but not "options".
int makefoldset(FILE *fd) int makefoldset(FILE *fd)
{ {
if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, 0) == FAIL if (put_setstring(fd, "setlocal", "fdm", (char_u **)&curwin->w_p_fdm, 0) == FAIL
|| put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, 0) || put_setstring(fd, "setlocal", "fde", (char_u **)&curwin->w_p_fde, 0)
== FAIL == FAIL
|| put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, 0) || put_setstring(fd, "setlocal", "fmr", (char_u **)&curwin->w_p_fmr, 0)
== FAIL == FAIL
|| put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, 0) || put_setstring(fd, "setlocal", "fdi", (char_u **)&curwin->w_p_fdi, 0)
== FAIL == FAIL
|| put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL || put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == FAIL
|| put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL || put_setnum(fd, "setlocal", "fml", &curwin->w_p_fml) == FAIL
@ -3803,7 +3803,7 @@ void unset_global_local_option(char *name, void *from)
clear_string_option(&((win_T *)from)->w_p_stl); clear_string_option(&((win_T *)from)->w_p_stl);
break; break;
case PV_WBR: case PV_WBR:
clear_string_option((char_u **)&((win_T *)from)->w_p_wbr); clear_string_option(&((win_T *)from)->w_p_wbr);
break; break;
case PV_UL: case PV_UL:
buf->b_p_ul = NO_LOCAL_UNDOLEVEL; buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
@ -3816,12 +3816,12 @@ void unset_global_local_option(char *name, void *from)
break; break;
case PV_LCS: case PV_LCS:
clear_string_option(&((win_T *)from)->w_p_lcs); clear_string_option(&((win_T *)from)->w_p_lcs);
set_chars_option((win_T *)from, &((win_T *)from)->w_p_lcs, true); set_chars_option((win_T *)from, (char_u **)&((win_T *)from)->w_p_lcs, true);
redraw_later((win_T *)from, UPD_NOT_VALID); redraw_later((win_T *)from, UPD_NOT_VALID);
break; break;
case PV_FCS: case PV_FCS:
clear_string_option(&((win_T *)from)->w_p_fcs); clear_string_option(&((win_T *)from)->w_p_fcs);
set_chars_option((win_T *)from, &((win_T *)from)->w_p_fcs, true); set_chars_option((win_T *)from, (char_u **)&((win_T *)from)->w_p_fcs, true);
redraw_later((win_T *)from, UPD_NOT_VALID); redraw_later((win_T *)from, UPD_NOT_VALID);
break; break;
case PV_VE: case PV_VE:
@ -4238,7 +4238,7 @@ char_u *get_equalprg(void)
if (*curbuf->b_p_ep == NUL) { if (*curbuf->b_p_ep == NUL) {
return p_ep; return p_ep;
} }
return curbuf->b_p_ep; return (char_u *)curbuf->b_p_ep;
} }
/// Copy options from one window to another. /// Copy options from one window to another.
@ -4260,19 +4260,19 @@ void copy_winopt(winopt_T *from, winopt_T *to)
to->wo_list = from->wo_list; to->wo_list = from->wo_list;
to->wo_nu = from->wo_nu; to->wo_nu = from->wo_nu;
to->wo_rnu = from->wo_rnu; to->wo_rnu = from->wo_rnu;
to->wo_ve = vim_strsave(from->wo_ve); to->wo_ve = xstrdup(from->wo_ve);
to->wo_ve_flags = from->wo_ve_flags; to->wo_ve_flags = from->wo_ve_flags;
to->wo_nuw = from->wo_nuw; to->wo_nuw = from->wo_nuw;
to->wo_rl = from->wo_rl; to->wo_rl = from->wo_rl;
to->wo_rlc = vim_strsave(from->wo_rlc); to->wo_rlc = xstrdup(from->wo_rlc);
to->wo_sbr = vim_strsave(from->wo_sbr); to->wo_sbr = xstrdup(from->wo_sbr);
to->wo_stl = vim_strsave(from->wo_stl); to->wo_stl = xstrdup(from->wo_stl);
to->wo_wbr = xstrdup(from->wo_wbr); to->wo_wbr = xstrdup(from->wo_wbr);
to->wo_wrap = from->wo_wrap; to->wo_wrap = from->wo_wrap;
to->wo_wrap_save = from->wo_wrap_save; to->wo_wrap_save = from->wo_wrap_save;
to->wo_lbr = from->wo_lbr; to->wo_lbr = from->wo_lbr;
to->wo_bri = from->wo_bri; to->wo_bri = from->wo_bri;
to->wo_briopt = vim_strsave(from->wo_briopt); to->wo_briopt = xstrdup(from->wo_briopt);
to->wo_scb = from->wo_scb; to->wo_scb = from->wo_scb;
to->wo_scb_save = from->wo_scb_save; to->wo_scb_save = from->wo_scb_save;
to->wo_crb = from->wo_crb; to->wo_crb = from->wo_crb;
@ -4280,32 +4280,30 @@ void copy_winopt(winopt_T *from, winopt_T *to)
to->wo_spell = from->wo_spell; to->wo_spell = from->wo_spell;
to->wo_cuc = from->wo_cuc; to->wo_cuc = from->wo_cuc;
to->wo_cul = from->wo_cul; to->wo_cul = from->wo_cul;
to->wo_culopt = vim_strsave(from->wo_culopt); to->wo_culopt = xstrdup(from->wo_culopt);
to->wo_cc = vim_strsave(from->wo_cc); to->wo_cc = xstrdup(from->wo_cc);
to->wo_diff = from->wo_diff; to->wo_diff = from->wo_diff;
to->wo_diff_saved = from->wo_diff_saved; to->wo_diff_saved = from->wo_diff_saved;
to->wo_cocu = vim_strsave(from->wo_cocu); to->wo_cocu = xstrdup(from->wo_cocu);
to->wo_cole = from->wo_cole; to->wo_cole = from->wo_cole;
to->wo_fdc = vim_strsave(from->wo_fdc); to->wo_fdc = xstrdup(from->wo_fdc);
to->wo_fdc_save = from->wo_diff_saved to->wo_fdc_save = from->wo_diff_saved ? xstrdup(from->wo_fdc_save) : empty_option;
? vim_strsave(from->wo_fdc_save) : empty_option;
to->wo_fen = from->wo_fen; to->wo_fen = from->wo_fen;
to->wo_fen_save = from->wo_fen_save; to->wo_fen_save = from->wo_fen_save;
to->wo_fdi = vim_strsave(from->wo_fdi); to->wo_fdi = xstrdup(from->wo_fdi);
to->wo_fml = from->wo_fml; to->wo_fml = from->wo_fml;
to->wo_fdl = from->wo_fdl; to->wo_fdl = from->wo_fdl;
to->wo_fdl_save = from->wo_fdl_save; to->wo_fdl_save = from->wo_fdl_save;
to->wo_fdm = vim_strsave(from->wo_fdm); to->wo_fdm = xstrdup(from->wo_fdm);
to->wo_fdm_save = from->wo_diff_saved to->wo_fdm_save = from->wo_diff_saved ? xstrdup(from->wo_fdm_save) : empty_option;
? vim_strsave(from->wo_fdm_save) : empty_option;
to->wo_fdn = from->wo_fdn; to->wo_fdn = from->wo_fdn;
to->wo_fde = vim_strsave(from->wo_fde); to->wo_fde = xstrdup(from->wo_fde);
to->wo_fdt = vim_strsave(from->wo_fdt); to->wo_fdt = xstrdup(from->wo_fdt);
to->wo_fmr = vim_strsave(from->wo_fmr); to->wo_fmr = xstrdup(from->wo_fmr);
to->wo_scl = vim_strsave(from->wo_scl); to->wo_scl = xstrdup(from->wo_scl);
to->wo_winhl = vim_strsave(from->wo_winhl); to->wo_winhl = xstrdup(from->wo_winhl);
to->wo_fcs = vim_strsave(from->wo_fcs); to->wo_fcs = xstrdup(from->wo_fcs);
to->wo_lcs = vim_strsave(from->wo_lcs); to->wo_lcs = xstrdup(from->wo_lcs);
to->wo_winbl = from->wo_winbl; to->wo_winbl = from->wo_winbl;
// Copy the script context so that we know were the value was last set. // Copy the script context so that we know were the value was last set.
@ -4343,7 +4341,7 @@ static void check_winopt(winopt_T *wop)
check_string_option(&wop->wo_fcs); check_string_option(&wop->wo_fcs);
check_string_option(&wop->wo_lcs); check_string_option(&wop->wo_lcs);
check_string_option(&wop->wo_ve); check_string_option(&wop->wo_ve);
check_string_option((char_u **)&wop->wo_wbr); check_string_option(&wop->wo_wbr);
} }
/// Free the allocated memory inside a winopt_T. /// Free the allocated memory inside a winopt_T.
@ -4369,7 +4367,7 @@ void clear_winopt(winopt_T *wop)
clear_string_option(&wop->wo_fcs); clear_string_option(&wop->wo_fcs);
clear_string_option(&wop->wo_lcs); clear_string_option(&wop->wo_lcs);
clear_string_option(&wop->wo_ve); clear_string_option(&wop->wo_ve);
clear_string_option((char_u **)&wop->wo_wbr); clear_string_option(&wop->wo_wbr);
} }
void didset_window_options(win_T *wp, bool valid_cursor) void didset_window_options(win_T *wp, bool valid_cursor)
@ -4377,8 +4375,8 @@ void didset_window_options(win_T *wp, bool valid_cursor)
check_colorcolumn(wp); check_colorcolumn(wp);
briopt_check(wp); briopt_check(wp);
fill_culopt_flags(NULL, wp); fill_culopt_flags(NULL, wp);
set_chars_option(wp, &wp->w_p_fcs, true); set_chars_option(wp, (char_u **)&wp->w_p_fcs, true);
set_chars_option(wp, &wp->w_p_lcs, true); set_chars_option(wp, (char_u **)&wp->w_p_lcs, true);
parse_winhl_opt(wp); // sets w_hl_needs_update also for w_p_winbl parse_winhl_opt(wp); // sets w_hl_needs_update also for w_p_winbl
check_blending(wp); check_blending(wp);
set_winbar_win(wp, false, valid_cursor); set_winbar_win(wp, false, valid_cursor);
@ -4451,7 +4449,7 @@ void buf_copy_options(buf_T *buf, int flags)
// (jumping back to a help file with CTRL-T or CTRL-O) // (jumping back to a help file with CTRL-T or CTRL-O)
dont_do_help = ((flags & BCO_NOHELP) && buf->b_help) || buf->b_p_initialized; dont_do_help = ((flags & BCO_NOHELP) && buf->b_help) || buf->b_p_initialized;
if (dont_do_help) { // don't free b_p_isk if (dont_do_help) { // don't free b_p_isk
save_p_isk = buf->b_p_isk; save_p_isk = (char_u *)buf->b_p_isk;
buf->b_p_isk = NULL; buf->b_p_isk = NULL;
} }
// Always free the allocated strings. If not already initialized, // Always free the allocated strings. If not already initialized,
@ -4459,19 +4457,19 @@ 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 = vim_strsave(p_fenc); buf->b_p_fenc = (char *)vim_strsave(p_fenc);
switch (*p_ffs) { switch (*p_ffs) {
case 'm': case 'm':
buf->b_p_ff = vim_strsave((char_u *)FF_MAC); buf->b_p_ff = xstrdup(FF_MAC);
break; break;
case 'd': case 'd':
buf->b_p_ff = vim_strsave((char_u *)FF_DOS); buf->b_p_ff = xstrdup(FF_DOS);
break; break;
case 'u': case 'u':
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); buf->b_p_ff = xstrdup(FF_UNIX);
break; break;
default: default:
buf->b_p_ff = vim_strsave(p_ff); buf->b_p_ff = (char *)vim_strsave(p_ff);
break; break;
} }
buf->b_p_bh = empty_option; buf->b_p_bh = empty_option;
@ -4516,42 +4514,42 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_swf = p_swf; buf->b_p_swf = p_swf;
COPY_OPT_SCTX(buf, BV_SWF); COPY_OPT_SCTX(buf, BV_SWF);
} }
buf->b_p_cpt = vim_strsave(p_cpt); buf->b_p_cpt = (char *)vim_strsave(p_cpt);
COPY_OPT_SCTX(buf, BV_CPT); COPY_OPT_SCTX(buf, BV_CPT);
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
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 = vim_strsave(p_cfu); buf->b_p_cfu = (char *)vim_strsave(p_cfu);
COPY_OPT_SCTX(buf, BV_CFU); COPY_OPT_SCTX(buf, BV_CFU);
buf->b_p_ofu = vim_strsave(p_ofu); buf->b_p_ofu = (char *)vim_strsave(p_ofu);
COPY_OPT_SCTX(buf, BV_OFU); COPY_OPT_SCTX(buf, BV_OFU);
buf->b_p_tfu = 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);
buf->b_p_sts = p_sts; buf->b_p_sts = p_sts;
COPY_OPT_SCTX(buf, BV_STS); COPY_OPT_SCTX(buf, BV_STS);
buf->b_p_sts_nopaste = p_sts_nopaste; buf->b_p_sts_nopaste = p_sts_nopaste;
buf->b_p_vsts = vim_strsave(p_vsts); buf->b_p_vsts = (char *)vim_strsave(p_vsts);
COPY_OPT_SCTX(buf, BV_VSTS); COPY_OPT_SCTX(buf, BV_VSTS);
if (p_vsts && p_vsts != empty_option) { if (p_vsts && p_vsts != (char_u *)empty_option) {
(void)tabstop_set(p_vsts, &buf->b_p_vsts_array); (void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
} else { } else {
buf->b_p_vsts_array = NULL; buf->b_p_vsts_array = NULL;
} }
buf->b_p_vsts_nopaste = p_vsts_nopaste buf->b_p_vsts_nopaste = p_vsts_nopaste
? vim_strsave(p_vsts_nopaste) ? (char *)vim_strsave(p_vsts_nopaste)
: NULL; : NULL;
buf->b_p_com = vim_strsave(p_com); buf->b_p_com = (char *)vim_strsave(p_com);
COPY_OPT_SCTX(buf, BV_COM); COPY_OPT_SCTX(buf, BV_COM);
buf->b_p_cms = 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);
buf->b_p_fo = vim_strsave(p_fo); buf->b_p_fo = (char *)vim_strsave(p_fo);
COPY_OPT_SCTX(buf, BV_FO); COPY_OPT_SCTX(buf, BV_FO);
buf->b_p_flp = vim_strsave(p_flp); buf->b_p_flp = (char *)vim_strsave(p_flp);
COPY_OPT_SCTX(buf, BV_FLP); COPY_OPT_SCTX(buf, BV_FLP);
buf->b_p_nf = vim_strsave(p_nf); buf->b_p_nf = (char *)vim_strsave(p_nf);
COPY_OPT_SCTX(buf, BV_NF); COPY_OPT_SCTX(buf, BV_NF);
buf->b_p_mps = vim_strsave(p_mps); buf->b_p_mps = (char *)vim_strsave(p_mps);
COPY_OPT_SCTX(buf, BV_MPS); COPY_OPT_SCTX(buf, BV_MPS);
buf->b_p_si = p_si; buf->b_p_si = p_si;
COPY_OPT_SCTX(buf, BV_SI); COPY_OPT_SCTX(buf, BV_SI);
@ -4561,18 +4559,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 = vim_strsave(p_cink); buf->b_p_cink = (char *)vim_strsave(p_cink);
COPY_OPT_SCTX(buf, BV_CINK); COPY_OPT_SCTX(buf, BV_CINK);
buf->b_p_cino = vim_strsave(p_cino); buf->b_p_cino = (char *)vim_strsave(p_cino);
COPY_OPT_SCTX(buf, BV_CINO); COPY_OPT_SCTX(buf, BV_CINO);
buf->b_p_cinsd = vim_strsave(p_cinsd); buf->b_p_cinsd = (char *)vim_strsave(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 = vim_strsave(p_cinw); buf->b_p_cinw = (char *)vim_strsave(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);
@ -4581,25 +4579,25 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_smc = p_smc; buf->b_p_smc = p_smc;
COPY_OPT_SCTX(buf, BV_SMC); COPY_OPT_SCTX(buf, BV_SMC);
buf->b_s.b_syn_isk = empty_option; buf->b_s.b_syn_isk = empty_option;
buf->b_s.b_p_spc = vim_strsave(p_spc); buf->b_s.b_p_spc = (char *)vim_strsave(p_spc);
COPY_OPT_SCTX(buf, BV_SPC); COPY_OPT_SCTX(buf, BV_SPC);
(void)compile_cap_prog(&buf->b_s); (void)compile_cap_prog(&buf->b_s);
buf->b_s.b_p_spf = vim_strsave(p_spf); buf->b_s.b_p_spf = (char *)vim_strsave(p_spf);
COPY_OPT_SCTX(buf, BV_SPF); COPY_OPT_SCTX(buf, BV_SPF);
buf->b_s.b_p_spl = vim_strsave(p_spl); buf->b_s.b_p_spl = (char *)vim_strsave(p_spl);
COPY_OPT_SCTX(buf, BV_SPL); COPY_OPT_SCTX(buf, BV_SPL);
buf->b_s.b_p_spo = vim_strsave(p_spo); buf->b_s.b_p_spo = (char *)vim_strsave(p_spo);
COPY_OPT_SCTX(buf, BV_SPO); COPY_OPT_SCTX(buf, BV_SPO);
buf->b_p_inde = vim_strsave(p_inde); buf->b_p_inde = (char *)vim_strsave(p_inde);
COPY_OPT_SCTX(buf, BV_INDE); COPY_OPT_SCTX(buf, BV_INDE);
buf->b_p_indk = vim_strsave(p_indk); buf->b_p_indk = (char *)vim_strsave(p_indk);
COPY_OPT_SCTX(buf, BV_INDK); COPY_OPT_SCTX(buf, BV_INDK);
buf->b_p_fp = empty_option; buf->b_p_fp = empty_option;
buf->b_p_fex = 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 = vim_strsave(p_sua); buf->b_p_sua = (char *)vim_strsave(p_sua);
COPY_OPT_SCTX(buf, BV_SUA); COPY_OPT_SCTX(buf, BV_SUA);
buf->b_p_keymap = 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);
buf->b_kmap_state |= KEYMAP_INIT; buf->b_kmap_state |= KEYMAP_INIT;
// This isn't really an option, but copying the langmap and IME // This isn't really an option, but copying the langmap and IME
@ -4626,12 +4624,12 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_tc_flags = 0; buf->b_tc_flags = 0;
buf->b_p_def = empty_option; buf->b_p_def = empty_option;
buf->b_p_inc = empty_option; buf->b_p_inc = empty_option;
buf->b_p_inex = vim_strsave(p_inex); buf->b_p_inex = (char *)vim_strsave(p_inex);
COPY_OPT_SCTX(buf, BV_INEX); COPY_OPT_SCTX(buf, BV_INEX);
buf->b_p_dict = empty_option; buf->b_p_dict = empty_option;
buf->b_p_tsr = empty_option; buf->b_p_tsr = empty_option;
buf->b_p_tsrfu = empty_option; buf->b_p_tsrfu = empty_option;
buf->b_p_qe = vim_strsave(p_qe); buf->b_p_qe = (char *)vim_strsave(p_qe);
COPY_OPT_SCTX(buf, BV_QE); COPY_OPT_SCTX(buf, BV_QE);
buf->b_p_udf = p_udf; buf->b_p_udf = p_udf;
COPY_OPT_SCTX(buf, BV_UDF); COPY_OPT_SCTX(buf, BV_UDF);
@ -4645,21 +4643,21 @@ void buf_copy_options(buf_T *buf, int flags)
* or to a help buffer. * or to a help buffer.
*/ */
if (dont_do_help) { if (dont_do_help) {
buf->b_p_isk = save_p_isk; buf->b_p_isk = (char *)save_p_isk;
if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) { if (p_vts && p_vts != (char_u *)empty_option && !buf->b_p_vts_array) {
(void)tabstop_set(p_vts, &buf->b_p_vts_array); (void)tabstop_set(p_vts, &buf->b_p_vts_array);
} else { } else {
buf->b_p_vts_array = NULL; buf->b_p_vts_array = NULL;
} }
} else { } else {
buf->b_p_isk = vim_strsave(p_isk); buf->b_p_isk = (char *)vim_strsave(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;
COPY_OPT_SCTX(buf, BV_TS); COPY_OPT_SCTX(buf, BV_TS);
buf->b_p_vts = vim_strsave(p_vts); buf->b_p_vts = (char *)vim_strsave(p_vts);
COPY_OPT_SCTX(buf, BV_VTS); COPY_OPT_SCTX(buf, BV_VTS);
if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) { if (p_vts && p_vts != (char_u *)empty_option && !buf->b_p_vts_array) {
(void)tabstop_set(p_vts, &buf->b_p_vts_array); (void)tabstop_set(p_vts, &buf->b_p_vts_array);
} else { } else {
buf->b_p_vts_array = NULL; buf->b_p_vts_array = NULL;
@ -5065,7 +5063,7 @@ bool has_format_option(int x)
if (p_paste) { if (p_paste) {
return false; return false;
} }
return vim_strchr((char *)curbuf->b_p_fo, x) != NULL; return vim_strchr(curbuf->b_p_fo, x) != NULL;
} }
/// @returns true if "x" is present in 'shortmess' option, or /// @returns true if "x" is present in 'shortmess' option, or
@ -5105,7 +5103,7 @@ static void paste_option_changed(void)
xfree(buf->b_p_vsts_nopaste); xfree(buf->b_p_vsts_nopaste);
} }
buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_option buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_option
? vim_strsave(buf->b_p_vsts) ? xstrdup(buf->b_p_vsts)
: NULL; : NULL;
} }
@ -5124,7 +5122,7 @@ static void paste_option_changed(void)
if (p_vsts_nopaste) { if (p_vsts_nopaste) {
xfree(p_vsts_nopaste); xfree(p_vsts_nopaste);
} }
p_vsts_nopaste = p_vsts && p_vsts != empty_option p_vsts_nopaste = p_vsts && p_vsts != (char_u *)empty_option
? vim_strsave(p_vsts) ? vim_strsave(p_vsts)
: NULL; : NULL;
} }
@ -5160,9 +5158,9 @@ static void paste_option_changed(void)
p_sts = 0; p_sts = 0;
p_ai = 0; p_ai = 0;
if (p_vsts) { if (p_vsts) {
free_string_option(p_vsts); free_string_option((char *)p_vsts);
} }
p_vsts = empty_option; p_vsts = (char_u *)empty_option;
} else if (old_p_paste) { } else if (old_p_paste) {
// Paste switched from on to off: Restore saved values. // Paste switched from on to off: Restore saved values.
@ -5176,12 +5174,10 @@ static void paste_option_changed(void)
if (buf->b_p_vsts) { if (buf->b_p_vsts) {
free_string_option(buf->b_p_vsts); free_string_option(buf->b_p_vsts);
} }
buf->b_p_vsts = buf->b_p_vsts_nopaste buf->b_p_vsts = buf->b_p_vsts_nopaste ? xstrdup(buf->b_p_vsts_nopaste) : empty_option;
? vim_strsave(buf->b_p_vsts_nopaste)
: empty_option;
xfree(buf->b_p_vsts_array); xfree(buf->b_p_vsts_array);
if (buf->b_p_vsts && buf->b_p_vsts != empty_option) { if (buf->b_p_vsts && buf->b_p_vsts != empty_option) {
(void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array); (void)tabstop_set((char_u *)buf->b_p_vsts, &buf->b_p_vsts_array);
} else { } else {
buf->b_p_vsts_array = NULL; buf->b_p_vsts_array = NULL;
} }
@ -5203,9 +5199,9 @@ static void paste_option_changed(void)
p_tw = p_tw_nopaste; p_tw = p_tw_nopaste;
p_wm = p_wm_nopaste; p_wm = p_wm_nopaste;
if (p_vsts) { if (p_vsts) {
free_string_option(p_vsts); free_string_option((char *)p_vsts);
} }
p_vsts = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : empty_option; p_vsts = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : (char_u *)empty_option;
} }
old_p_paste = p_paste; old_p_paste = p_paste;
@ -5286,7 +5282,7 @@ int fill_culopt_flags(char_u *val, win_T *wp)
char_u culopt_flags_new = 0; char_u culopt_flags_new = 0;
if (val == NULL) { if (val == NULL) {
p = wp->w_p_culopt; p = (char_u *)wp->w_p_culopt;
} else { } else {
p = val; p = val;
} }
@ -5437,7 +5433,7 @@ bool can_bs(int what)
/// the file must be considered changed when the value is different. /// the file must be considered changed when the value is different.
void save_file_ff(buf_T *buf) void save_file_ff(buf_T *buf)
{ {
buf->b_start_ffc = *buf->b_p_ff; buf->b_start_ffc = (unsigned char)(*buf->b_p_ff);
buf->b_start_eol = buf->b_p_eol; buf->b_start_eol = buf->b_p_eol;
buf->b_start_bomb = buf->b_p_bomb; buf->b_start_bomb = buf->b_p_bomb;
@ -5445,7 +5441,7 @@ void save_file_ff(buf_T *buf)
if (buf->b_start_fenc == NULL if (buf->b_start_fenc == NULL
|| STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) { || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) {
xfree(buf->b_start_fenc); xfree(buf->b_start_fenc);
buf->b_start_fenc = (char *)vim_strsave(buf->b_p_fenc); buf->b_start_fenc = xstrdup(buf->b_p_fenc);
} }
} }
@ -5493,7 +5489,7 @@ bool briopt_check(win_T *wp)
bool bri_sbr = false; bool bri_sbr = false;
int bri_list = 0; int bri_list = 0;
char *p = (char *)wp->w_p_briopt; char *p = wp->w_p_briopt;
while (*p != NUL) { while (*p != NUL) {
if (STRNCMP(p, "shift:", 6) == 0 if (STRNCMP(p, "shift:", 6) == 0
&& ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6]))) { && ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6]))) {
@ -5550,16 +5546,16 @@ char_u *get_showbreak_value(win_T *const win)
return p_sbr; return p_sbr;
} }
if (STRCMP(win->w_p_sbr, "NONE") == 0) { if (STRCMP(win->w_p_sbr, "NONE") == 0) {
return empty_option; return (char_u *)empty_option;
} }
return win->w_p_sbr; return (char_u *)win->w_p_sbr;
} }
/// Return the current end-of-line type: EOL_DOS, EOL_UNIX or EOL_MAC. /// Return the current end-of-line type: EOL_DOS, EOL_UNIX or EOL_MAC.
int get_fileformat(const buf_T *buf) int get_fileformat(const buf_T *buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{ {
int c = *buf->b_p_ff; int c = (unsigned char)(*buf->b_p_ff);
if (buf->b_p_bin || c == 'u') { if (buf->b_p_bin || c == 'u') {
return EOL_UNIX; return EOL_UNIX;
@ -5586,7 +5582,7 @@ int get_fileformat_force(const buf_T *buf, const exarg_T *eap)
? (eap->force_bin == FORCE_BIN) : buf->b_p_bin) { ? (eap->force_bin == FORCE_BIN) : buf->b_p_bin) {
return EOL_UNIX; return EOL_UNIX;
} }
c = *buf->b_p_ff; c = (unsigned char)(*buf->b_p_ff);
} }
if (c == 'u') { if (c == 'u') {
return EOL_UNIX; return EOL_UNIX;

View File

@ -254,14 +254,14 @@ void check_buf_options(buf_T *buf)
/// memory, vim_strsave() returned NULL, which was replaced by empty_option by /// memory, vim_strsave() returned NULL, which was replaced by empty_option by
/// check_options(). /// check_options().
/// Does NOT check for P_ALLOCED flag! /// Does NOT check for P_ALLOCED flag!
void free_string_option(char_u *p) void free_string_option(char *p)
{ {
if (p != empty_option) { if (p != empty_option) {
xfree(p); xfree(p);
} }
} }
void clear_string_option(char_u **pp) void clear_string_option(char **pp)
{ {
if (*pp != empty_option) { if (*pp != empty_option) {
xfree(*pp); xfree(*pp);
@ -269,7 +269,7 @@ void clear_string_option(char_u **pp)
*pp = empty_option; *pp = empty_option;
} }
void check_string_option(char_u **pp) void check_string_option(char **pp)
{ {
if (*pp == NULL) { if (*pp == NULL) {
*pp = empty_option; *pp = empty_option;
@ -292,7 +292,7 @@ static void set_string_option_global(int opt_idx, char_u **varp)
} }
if (!is_global_option(opt_idx) && p != varp) { if (!is_global_option(opt_idx) && p != varp) {
s = vim_strsave(*varp); s = vim_strsave(*varp);
free_string_option(*p); free_string_option((char *)(*p));
*p = s; *p = s;
} }
} }
@ -332,7 +332,7 @@ void set_string_option_direct(const char *name, int opt_idx, const char *val, in
{ {
varp = (char **)get_option_varp_scope(idx, both ? OPT_LOCAL : opt_flags); varp = (char **)get_option_varp_scope(idx, both ? OPT_LOCAL : opt_flags);
if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED)) { if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED)) {
free_string_option((char_u *)(*varp)); free_string_option(*varp);
} }
*varp = s; *varp = s;
@ -346,8 +346,8 @@ void set_string_option_direct(const char *name, int opt_idx, const char *val, in
// When setting both values of a global option with a local value, // When setting both values of a global option with a local value,
// make the local value empty, so that the global value is used. // make the local value empty, so that the global value is used.
if (is_global_local_option(idx) && both) { if (is_global_local_option(idx) && both) {
free_string_option((char_u *)(*varp)); free_string_option(*varp);
*varp = (char *)empty_option; *varp = empty_option;
} }
if (set_sid != SID_NONE) { if (set_sid != SID_NONE) {
sctx_T script_ctx; sctx_T script_ctx;
@ -662,7 +662,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
unsigned int *flags = &bkc_flags; unsigned int *flags = &bkc_flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
bkc = curbuf->b_p_bkc; bkc = (char_u *)curbuf->b_p_bkc;
flags = &curbuf->b_bkc_flags; flags = &curbuf->b_bkc_flags;
} }
@ -687,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 == &curwin->w_p_briopt) { // 'breakindentopt' } else if (varp == (char_u **)&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 == &(curbuf->b_p_isk) || varp == (char_u **)&(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[]
@ -712,12 +712,12 @@ 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 == &curwin->w_p_culopt } else if (varp == (char_u **)&curwin->w_p_culopt
|| gvarp == &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(*varp, curwin) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &curwin->w_p_cc) { // 'colorcolumn' } else if (varp == (char_u **)&curwin->w_p_cc) { // 'colorcolumn'
errmsg = check_colorcolumn(curwin); errmsg = check_colorcolumn(curwin);
} else if (varp == &p_hlg) { // 'helplang' } else if (varp == &p_hlg) { // 'helplang'
// Check for "", "ab", "ab,cd", etc. // Check for "", "ab", "ab,cd", etc.
@ -780,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(p_bg); free_string_option((char *)p_bg);
p_bg = vim_strsave((char_u *)(dark ? "dark" : "light")); p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
check_string_option(&p_bg); check_string_option((char **)&p_bg);
init_highlight(false, false); init_highlight(false, false);
} }
} else { } else {
@ -841,7 +841,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
p = (char *)enc_canonize(p_penc); p = (char *)enc_canonize(p_penc);
xfree(p_penc); xfree(p_penc);
p_penc = (char_u *)p; p_penc = (char_u *)p;
} else if (varp == &curbuf->b_p_keymap) { } else if (varp == (char_u **)&curbuf->b_p_keymap) {
if (!valid_filetype(*varp)) { if (!valid_filetype(*varp)) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
@ -960,11 +960,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
FOR_ALL_TAB_WINDOWS(tp, wp) { FOR_ALL_TAB_WINDOWS(tp, wp) {
// If no error was returned above, we don't expect an error // If no error was returned above, we don't expect an error
// here, so ignore the return value. // here, so ignore the return value.
(void)set_chars_option(wp, &wp->w_p_lcs, true); (void)set_chars_option(wp, (char_u **)&wp->w_p_lcs, true);
} }
redraw_all_later(UPD_NOT_VALID); redraw_all_later(UPD_NOT_VALID);
} }
} else if (varp == &curwin->w_p_lcs) { // local 'listchars' } else if (varp == (char_u **)&curwin->w_p_lcs) { // local 'listchars'
errmsg = set_chars_option(curwin, varp, true); errmsg = set_chars_option(curwin, varp, true);
} else if (varp == &p_fcs) { // global 'fillchars' } else if (varp == &p_fcs) { // global 'fillchars'
errmsg = set_chars_option(curwin, varp, false); errmsg = set_chars_option(curwin, varp, false);
@ -977,11 +977,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
FOR_ALL_TAB_WINDOWS(tp, wp) { FOR_ALL_TAB_WINDOWS(tp, wp) {
// If no error was returned above, we don't expect an error // If no error was returned above, we don't expect an error
// here, so ignore the return value. // here, so ignore the return value.
(void)set_chars_option(wp, &wp->w_p_fcs, true); (void)set_chars_option(wp, (char_u **)&wp->w_p_fcs, true);
} }
redraw_all_later(UPD_NOT_VALID); redraw_all_later(UPD_NOT_VALID);
} }
} else if (varp == &curwin->w_p_fcs) { // local 'fillchars' } else if (varp == (char_u **)&curwin->w_p_fcs) { // local 'fillchars'
errmsg = set_chars_option(curwin, varp, true); errmsg = set_chars_option(curwin, varp, true);
} else if (varp == &p_cedit) { // 'cedit' } else if (varp == &p_cedit) { // 'cedit'
errmsg = check_cedit(); errmsg = check_cedit();
@ -1117,11 +1117,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, true) != OK) { if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &(curwin->w_s->b_p_spl) // 'spell' } else if (varp == (char_u **)&(curwin->w_s->b_p_spl) // 'spell'
|| varp == &(curwin->w_s->b_p_spf)) { || varp == (char_u **)&(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 == &(curwin->w_s->b_p_spf); const bool is_spellfile = varp == (char_u **)&(curwin->w_s->b_p_spf);
if ((is_spellfile && !valid_spellfile(*varp)) if ((is_spellfile && !valid_spellfile(*varp))
|| (!is_spellfile && !valid_spelllang(*varp))) { || (!is_spellfile && !valid_spelllang(*varp))) {
@ -1129,10 +1129,10 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
} else { } else {
errmsg = did_set_spell_option(is_spellfile); errmsg = did_set_spell_option(is_spellfile);
} }
} else if (varp == &(curwin->w_s->b_p_spc)) { } else if (varp == (char_u **)&(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 == &(curwin->w_s->b_p_spo)) { // 'spelloptions' } else if (varp == (char_u **)&(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;
} }
@ -1146,14 +1146,14 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
} }
} else if (gvarp == &p_bh) { } else if (gvarp == &p_bh) {
// When 'bufhidden' is set, check for valid value. // When 'bufhidden' is set, check for valid value.
if (check_opt_strings(curbuf->b_p_bh, p_bufhidden_values, false) != OK) { if (check_opt_strings((char_u *)curbuf->b_p_bh, p_bufhidden_values, false) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (gvarp == &p_bt) { } else if (gvarp == &p_bt) {
// When 'buftype' is set, check for valid value. // When 'buftype' is set, check for valid value.
if ((curbuf->terminal && curbuf->b_p_bt[0] != 't') if ((curbuf->terminal && curbuf->b_p_bt[0] != 't')
|| (!curbuf->terminal && curbuf->b_p_bt[0] == 't') || (!curbuf->terminal && curbuf->b_p_bt[0] == 't')
|| check_opt_strings(curbuf->b_p_bt, p_buftype_values, false) != OK) { || check_opt_strings((char_u *)curbuf->b_p_bt, p_buftype_values, false) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} else { } else {
if (curwin->w_status_height || global_stl_height()) { if (curwin->w_status_height || global_stl_height()) {
@ -1241,7 +1241,7 @@ 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 == &curwin->w_p_scl) { // 'signcolumn' } else if (varp == (char_u **)&curwin->w_p_scl) { // 'signcolumn'
if (check_signcolumn(*varp) != OK) { if (check_signcolumn(*varp) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
@ -1252,7 +1252,8 @@ 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 == &curwin->w_p_fdc || varp == &curwin->w_allbuf_opt.wo_fdc) { } else if (varp == (char_u **)&curwin->w_p_fdc
|| varp == (char_u **)&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(*varp, p_fdc_values, false) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
@ -1266,7 +1267,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL, &p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
CPO_TO_CPO_FLAGS); CPO_TO_CPO_FLAGS);
if (p != NULL) { if (p != NULL) {
free_string_option(p_pt); free_string_option((char *)p_pt);
p_pt = (char_u *)p; p_pt = (char_u *)p;
} }
} }
@ -1286,7 +1287,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
unsigned int *flags; unsigned int *flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
p = (char *)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 = (char *)p_tc;
@ -1308,7 +1309,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (diffopt_changed() == FAIL) { if (diffopt_changed() == FAIL) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (gvarp == &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(*varp, p_fdm_values, false) != OK
|| *curwin->w_p_fdm == NUL) { || *curwin->w_p_fdm == NUL) {
errmsg = e_invarg; errmsg = e_invarg;
@ -1318,11 +1319,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
newFoldLevel(); newFoldLevel();
} }
} }
} else if (varp == &curwin->w_p_fde) { // 'foldexpr' } else if (varp == (char_u **)&curwin->w_p_fde) { // 'foldexpr'
if (foldmethodIsExpr(curwin)) { if (foldmethodIsExpr(curwin)) {
foldUpdateAll(curwin); foldUpdateAll(curwin);
} }
} else if (gvarp == &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((char *)(*varp), ',');
if (p == NULL) { if (p == NULL) {
errmsg = N_("E536: comma required"); errmsg = N_("E536: comma required");
@ -1343,7 +1344,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (check_opt_strings(p_fcl, p_fcl_values, true) != OK) { if (check_opt_strings(p_fcl, p_fcl_values, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (gvarp == &curwin->w_allbuf_opt.wo_fdi) { // 'foldignore' } else if (gvarp == (char_u **)&curwin->w_allbuf_opt.wo_fdi) { // 'foldignore'
if (foldmethodIsIndent(curwin)) { if (foldmethodIsIndent(curwin)) {
foldUpdateAll(curwin); foldUpdateAll(curwin);
} }
@ -1352,7 +1353,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
unsigned int *flags = &ve_flags; unsigned int *flags = &ve_flags;
if (opt_flags & OPT_LOCAL) { if (opt_flags & OPT_LOCAL) {
ve = curwin->w_p_ve; ve = (char_u *)curwin->w_p_ve;
flags = &curwin->w_ve_flags; flags = &curwin->w_ve_flags;
} }
@ -1413,7 +1414,7 @@ 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 == &curwin->w_p_winhl) { } else if (varp == (char_u **)&curwin->w_p_winhl) {
if (!parse_winhl_opt(curwin)) { if (!parse_winhl_opt(curwin)) {
errmsg = e_invarg; errmsg = e_invarg;
} }
@ -1421,7 +1422,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) { if (opt_strings_flags(p_tpf, p_tpf_values, &tpf_flags, true) != OK) {
errmsg = e_invarg; errmsg = e_invarg;
} }
} else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop' } else if (varp == (char_u **)&(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])) {
@ -1446,7 +1447,7 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
} }
} }
} }
} else if (varp == &(curbuf->b_p_vts)) { // 'vartabstop' } else if (varp == (char_u **)&(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])) {
@ -1492,9 +1493,9 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
p = (char *)SHM_ALL; p = (char *)SHM_ALL;
} else if (varp == (char_u **)&(p_cpo)) { // 'cpoptions' } else if (varp == (char_u **)&(p_cpo)) { // 'cpoptions'
p = CPO_VI; p = CPO_VI;
} else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions' } else if (varp == (char_u **)&(curbuf->b_p_fo)) { // 'formatoptions'
p = FO_ALL; p = FO_ALL;
} else if (varp == &curwin->w_p_cocu) { // 'concealcursor' } else if (varp == (char_u **)&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;
@ -1511,7 +1512,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(*varp); free_string_option((char *)(*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) {
@ -1524,7 +1525,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(oldval); free_string_option((char *)oldval);
} }
set_option_flag(opt_idx, P_ALLOCED); set_option_flag(opt_idx, P_ALLOCED);
@ -1533,8 +1534,8 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
// global option with local value set to use global value; free // global option with local value set to use global value; free
// the local value and make it empty // the local value and make it empty
p = (char *)get_option_varp_scope(opt_idx, OPT_LOCAL); p = (char *)get_option_varp_scope(opt_idx, OPT_LOCAL);
free_string_option(*(char_u **)p); free_string_option(*(char **)p);
*(char_u **)p = empty_option; *(char **)p = empty_option;
} else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) { } else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) {
// May set global value for local option. // May set global value for local option.
set_string_option_global(opt_idx, varp); set_string_option_global(opt_idx, varp);
@ -1542,17 +1543,17 @@ 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 == &(curbuf->b_p_syn)) { if (varp == (char_u **)&(curbuf->b_p_syn)) {
static int syn_recursive = 0; static int syn_recursive = 0;
syn_recursive++; syn_recursive++;
// Only pass true for "force" when the value changed or not used // Only pass true for "force" when the value changed or not used
// recursively, to avoid endless recurrence. // recursively, to avoid endless recurrence.
apply_autocmds(EVENT_SYNTAX, (char *)curbuf->b_p_syn, curbuf->b_fname, apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, curbuf->b_fname,
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 == &(curbuf->b_p_ft)) { } else if (varp == (char_u **)&(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.
@ -1568,19 +1569,19 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
did_filetype = true; did_filetype = true;
// Only pass true for "force" when the value changed or not // Only pass true for "force" when the value changed or not
// used recursively, to avoid endless recurrence. // used recursively, to avoid endless recurrence.
apply_autocmds(EVENT_FILETYPE, (char *)curbuf->b_p_ft, curbuf->b_fname, apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname,
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 != &(curbuf->b_p_ft)) { if (varp != (char_u **)&(curbuf->b_p_ft)) {
varp = NULL; varp = NULL;
} }
secure = secure_save; secure = secure_save;
} }
} }
if (varp == &(curwin->w_s->b_p_spl)) { if (varp == (char_u **)&(curwin->w_s->b_p_spl)) {
char_u fname[200]; char_u fname[200];
char_u *q = curwin->w_s->b_p_spl; char_u *q = (char_u *)curwin->w_s->b_p_spl;
// Skip the first name if it is "cjk". // Skip the first name if it is "cjk".
if (STRNCMP(q, "cjk,", 4) == 0) { if (STRNCMP(q, "cjk,", 4) == 0) {

View File

@ -74,7 +74,7 @@ static bool have_wildcard(int num, char **file)
static bool have_dollars(int num, char **file) static bool have_dollars(int num, char **file)
{ {
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
if (vim_strchr((char *)file[i], '$') != NULL) { if (vim_strchr(file[i], '$') != NULL) {
return true; return true;
} }
} }

View File

@ -376,16 +376,16 @@ int path_fnamencmp(const char *const fname1, const char *const fname2, size_t le
const char *p1 = fname1; const char *p1 = fname1;
const char *p2 = fname2; const char *p2 = fname2;
while (len > 0) { while (len > 0) {
c1 = utf_ptr2char((const char_u *)p1); c1 = utf_ptr2char(p1);
c2 = utf_ptr2char((const char_u *)p2); c2 = utf_ptr2char(p2);
if ((c1 == NUL || c2 == NUL if ((c1 == NUL || c2 == NUL
|| (!((c1 == '/' || c1 == '\\') && (c2 == '\\' || c2 == '/')))) || (!((c1 == '/' || c1 == '\\') && (c2 == '\\' || c2 == '/'))))
&& (p_fic ? (c1 != c2 && CH_FOLD(c1) != CH_FOLD(c2)) : c1 != c2)) { && (p_fic ? (c1 != c2 && CH_FOLD(c1) != CH_FOLD(c2)) : c1 != c2)) {
break; break;
} }
len -= (size_t)utfc_ptr2len((const char_u *)p1); len -= (size_t)utfc_ptr2len(p1);
p1 += utfc_ptr2len((const char_u *)p1); p1 += utfc_ptr2len(p1);
p2 += utfc_ptr2len((const char_u *)p2); p2 += utfc_ptr2len(p2);
} }
return p_fic ? CH_FOLD(c1) - CH_FOLD(c2) : c1 - c2; return p_fic ? CH_FOLD(c1) - CH_FOLD(c2) : c1 - c2;
#else #else
@ -843,7 +843,7 @@ static bool is_unique(char_u *maybe_unique, garray_T *gap, int i)
*/ */
static void expand_path_option(char_u *curdir, garray_T *gap) static void expand_path_option(char_u *curdir, garray_T *gap)
{ {
char_u *path_option = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; char_u *path_option = *curbuf->b_p_path == NUL ? p_path : (char_u *)curbuf->b_p_path;
char_u *buf = xmalloc(MAXPATHL); char_u *buf = xmalloc(MAXPATHL);
while (*path_option != NUL) { while (*path_option != NUL) {
@ -1684,7 +1684,7 @@ void simplify_filename(char_u *filename)
static char *eval_includeexpr(const char *const ptr, const size_t len) static char *eval_includeexpr(const char *const ptr, const size_t len)
{ {
set_vim_var_string(VV_FNAME, ptr, (ptrdiff_t)len); set_vim_var_string(VV_FNAME, ptr, (ptrdiff_t)len);
char *res = eval_to_string_safe((char *)curbuf->b_p_inex, NULL, char *res = eval_to_string_safe(curbuf->b_p_inex, NULL,
was_set_insecurely(curwin, "includeexpr", OPT_LOCAL)); was_set_insecurely(curwin, "includeexpr", OPT_LOCAL));
set_vim_var_string(VV_FNAME, NULL, 0); set_vim_var_string(VV_FNAME, NULL, 0);
return res; return res;

View File

@ -1091,7 +1091,7 @@ static int qf_init_ext(qf_info_T *qi, int qf_idx, const char *restrict efile, bu
// Use the local value of 'errorformat' if it's set. // Use the local value of 'errorformat' if it's set.
if (errorformat == p_efm && tv == NULL && buf && *buf->b_p_efm != NUL) { if (errorformat == p_efm && tv == NULL && buf && *buf->b_p_efm != NUL) {
efm = (char *)buf->b_p_efm; efm = buf->b_p_efm;
} else { } else {
efm = errorformat; efm = errorformat;
} }
@ -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 = empty_option; // don't split again p_swb = (char_u *)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) {
@ -2994,7 +2994,7 @@ 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 == empty_option) { if (p_swb != (char_u *)old_swb && p_swb == (char_u *)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 = (char_u *)old_swb;
@ -4183,7 +4183,7 @@ int grep_internal(cmdidx_T cmdidx)
|| cmdidx == CMD_grepadd || cmdidx == CMD_grepadd
|| cmdidx == CMD_lgrepadd) || cmdidx == CMD_lgrepadd)
&& STRCMP("internal", && STRCMP("internal",
*curbuf->b_p_gp == NUL ? p_gp : curbuf->b_p_gp) == 0; *curbuf->b_p_gp == NUL ? p_gp : (char_u *)curbuf->b_p_gp) == 0;
} }
// Return the make/grep autocmd name. // Return the make/grep autocmd name.
@ -4241,7 +4241,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname)
// Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd" // Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd"
void ex_make(exarg_T *eap) void ex_make(exarg_T *eap)
{ {
char *enc = (*curbuf->b_p_menc != NUL) ? (char *)curbuf->b_p_menc : (char *)p_menc; char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : (char *)p_menc;
// Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". // Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal".
if (grep_internal(eap->cmdidx)) { if (grep_internal(eap->cmdidx)) {
@ -4981,7 +4981,7 @@ void ex_cfile(exarg_T *eap)
set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0); set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0);
} }
char *enc = (*curbuf->b_p_menc != NUL) ? (char *)curbuf->b_p_menc : (char *)p_menc; char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : (char *)p_menc;
if (is_loclist_cmd(eap->cmdidx)) { if (is_loclist_cmd(eap->cmdidx)) {
wp = curwin; wp = curwin;
@ -5305,7 +5305,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args)
} }
// Parse the list of arguments, wildcards have already been expanded. // Parse the list of arguments, wildcards have already been expanded.
if (get_arglist_exp((char_u *)p, &args->fcount, &args->fnames, true) == FAIL) { if (get_arglist_exp(p, &args->fcount, &args->fnames, true) == FAIL) {
return FAIL; return FAIL;
} }
if (args->fcount == 0) { if (args->fcount == 0) {
@ -5429,7 +5429,7 @@ static int vgr_process_files(win_T *wp, qf_info_T *qi, vgr_args_T *cmd_args, boo
// options! // options!
aco_save_T aco; aco_save_T aco;
aucmd_prepbuf(&aco, buf); aucmd_prepbuf(&aco, buf);
apply_autocmds(EVENT_FILETYPE, (char *)buf->b_p_ft, buf->b_fname, true, buf); apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, buf->b_fname, true, buf);
do_modelines(OPT_NOWIN); do_modelines(OPT_NOWIN);
aucmd_restbuf(&aco); aucmd_restbuf(&aco);
} }
@ -7065,7 +7065,7 @@ void ex_helpgrep(exarg_T *eap)
bool updated = false; bool updated = false;
// Make 'cpoptions' empty, the 'l' flag should not be used here. // Make 'cpoptions' empty, the 'l' flag should not be used here.
char *const save_cpo = p_cpo; char *const save_cpo = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
bool new_qi = false; bool new_qi = false;
if (is_loclist_cmd(eap->cmdidx)) { if (is_loclist_cmd(eap->cmdidx)) {
@ -7096,7 +7096,7 @@ void ex_helpgrep(exarg_T *eap)
updated = true; updated = true;
} }
if ((char_u *)p_cpo == empty_option) { if (p_cpo == empty_option) {
p_cpo = save_cpo; p_cpo = save_cpo;
} else { } else {
// Darn, some plugin changed the value. If it's still empty it was // Darn, some plugin changed the value. If it's still empty it was
@ -7104,7 +7104,7 @@ void ex_helpgrep(exarg_T *eap)
if (*p_cpo == NUL) { if (*p_cpo == NUL) {
set_option_value_give_err("cpo", 0L, save_cpo, 0); set_option_value_give_err("cpo", 0L, save_cpo, 0);
} }
free_string_option((char_u *)save_cpo); free_string_option(save_cpo);
} }
if (updated) { if (updated) {

View File

@ -69,7 +69,7 @@ bool conceal_cursor_line(const win_T *wp)
} else { } else {
return false; return false;
} }
return vim_strchr((char *)wp->w_p_cocu, c) != NULL; return vim_strchr(wp->w_p_cocu, c) != NULL;
} }
/// Whether cursorline is drawn in a special way /// Whether cursorline is drawn in a special way
@ -535,7 +535,7 @@ bool get_keymap_str(win_T *wp, char *fmt, char *buf, int len)
curwin = old_curwin; curwin = old_curwin;
if (p == NULL || *p == NUL) { if (p == NULL || *p == NUL) {
if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) { if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) {
p = (char *)wp->w_buffer->b_p_keymap; p = wp->w_buffer->b_p_keymap;
} else { } else {
p = "lang"; p = "lang";
} }
@ -1347,16 +1347,16 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
{ &wp->w_p_lcs_chars.conceal, "conceal", NUL }, { &wp->w_p_lcs_chars.conceal, "conceal", NUL },
}; };
if (varp == &p_lcs || varp == &wp->w_p_lcs) { if (varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs) {
tab = lcs_tab; tab = lcs_tab;
entries = ARRAY_SIZE(lcs_tab); entries = ARRAY_SIZE(lcs_tab);
if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) { if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
varp = &p_lcs; varp = &p_lcs;
} }
} else { } else {
tab = fcs_tab; tab = fcs_tab;
entries = ARRAY_SIZE(fcs_tab); entries = ARRAY_SIZE(fcs_tab);
if (varp == &wp->w_p_fcs && wp->w_p_fcs[0] == NUL) { if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
varp = &p_fcs; varp = &p_fcs;
} }
} }
@ -1370,7 +1370,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
*(tab[i].cp) = tab[i].def; *(tab[i].cp) = tab[i].def;
} }
} }
if (varp == &p_lcs || varp == &wp->w_p_lcs) { if (varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs) {
wp->w_p_lcs_chars.tab1 = NUL; wp->w_p_lcs_chars.tab1 = NUL;
wp->w_p_lcs_chars.tab3 = NUL; wp->w_p_lcs_chars.tab3 = NUL;
@ -1439,7 +1439,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
if (i == entries) { if (i == entries) {
len = (int)STRLEN("multispace"); len = (int)STRLEN("multispace");
len2 = (int)STRLEN("leadmultispace"); len2 = (int)STRLEN("leadmultispace");
if ((varp == &p_lcs || varp == &wp->w_p_lcs) if ((varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs)
&& STRNCMP(p, "multispace", len) == 0 && STRNCMP(p, "multispace", len) == 0
&& p[len] == ':' && p[len] == ':'
&& p[len + 1] != NUL) { && p[len + 1] != NUL) {
@ -1470,7 +1470,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
} }
p = s; p = s;
} }
} else if ((varp == &p_lcs || varp == &wp->w_p_lcs) } else if ((varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs)
&& STRNCMP(p, "leadmultispace", len2) == 0 && STRNCMP(p, "leadmultispace", len2) == 0
&& p[len2] == ':' && p[len2] == ':'
&& p[len2 + 1] != NUL) { && p[len2 + 1] != NUL) {
@ -1527,10 +1527,10 @@ char *check_chars_options(void)
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) {
if (set_chars_option(wp, &wp->w_p_lcs, true) != NULL) { if (set_chars_option(wp, (char_u **)&wp->w_p_lcs, true) != NULL) {
return e_conflicts_with_value_of_listchars; return e_conflicts_with_value_of_listchars;
} }
if (set_chars_option(wp, &wp->w_p_fcs, true) != NULL) { if (set_chars_option(wp, (char_u **)&wp->w_p_fcs, true) != NULL) {
return e_conflicts_with_value_of_fillchars; return e_conflicts_with_value_of_fillchars;
} }
} }

View File

@ -1696,34 +1696,34 @@ static bool find_rawstring_end(char_u *linep, pos_T *startpos, pos_T *endpos)
static void find_mps_values(int *initc, int *findc, bool *backwards, bool switchit) static void find_mps_values(int *initc, int *findc, bool *backwards, bool switchit)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
char_u *ptr = curbuf->b_p_mps; char *ptr = curbuf->b_p_mps;
while (*ptr != NUL) { while (*ptr != NUL) {
if (utf_ptr2char((char *)ptr) == *initc) { if (utf_ptr2char(ptr) == *initc) {
if (switchit) { if (switchit) {
*findc = *initc; *findc = *initc;
*initc = utf_ptr2char((char *)ptr + utfc_ptr2len((char *)ptr) + 1); *initc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1);
*backwards = true; *backwards = true;
} else { } else {
*findc = utf_ptr2char((char *)ptr + utfc_ptr2len((char *)ptr) + 1); *findc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1);
*backwards = false; *backwards = false;
} }
return; return;
} }
char_u *prev = ptr; char *prev = ptr;
ptr += utfc_ptr2len((char *)ptr) + 1; ptr += utfc_ptr2len(ptr) + 1;
if (utf_ptr2char((char *)ptr) == *initc) { if (utf_ptr2char(ptr) == *initc) {
if (switchit) { if (switchit) {
*findc = *initc; *findc = *initc;
*initc = utf_ptr2char((char *)prev); *initc = utf_ptr2char(prev);
*backwards = false; *backwards = false;
} else { } else {
*findc = utf_ptr2char((char *)prev); *findc = utf_ptr2char(prev);
*backwards = true; *backwards = true;
} }
return; return;
} }
ptr += utfc_ptr2len((char *)ptr); ptr += utfc_ptr2len(ptr);
if (*ptr == ',') { if (*ptr == ',') {
ptr++; ptr++;
} }
@ -2376,7 +2376,7 @@ void showmatch(int c)
* Only show match for chars in the 'matchpairs' option. * Only show match for chars in the 'matchpairs' option.
*/ */
// 'matchpairs' is "x:y,x:y" // 'matchpairs' is "x:y,x:y"
for (p = curbuf->b_p_mps; *p != NUL; p++) { for (p = (char_u *)curbuf->b_p_mps; *p != NUL; p++) {
if (utf_ptr2char((char *)p) == c && (curwin->w_p_rl ^ p_ri)) { if (utf_ptr2char((char *)p) == c && (curwin->w_p_rl ^ p_ri)) {
break; break;
} }
@ -4090,8 +4090,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
if (col_start < 0) { if (col_start < 0) {
goto abort_search; goto abort_search;
} }
col_end = find_next_quote(line, col_start + 1, quotechar, col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
curbuf->b_p_qe);
if (col_end < 0) { if (col_end < 0) {
// We were on a starting quote perhaps? // We were on a starting quote perhaps?
col_end = col_start; col_end = col_start;
@ -4102,8 +4101,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
if (line[col_end] != quotechar) { if (line[col_end] != quotechar) {
goto abort_search; goto abort_search;
} }
col_start = find_prev_quote(line, col_end, quotechar, col_start = find_prev_quote(line, col_end, quotechar, (char_u *)curbuf->b_p_qe);
curbuf->b_p_qe);
if (line[col_start] != quotechar) { if (line[col_start] != quotechar) {
// We were on an ending quote perhaps? // We were on an ending quote perhaps?
col_start = col_end; col_start = col_end;
@ -4132,8 +4130,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
goto abort_search; goto abort_search;
} }
// Find close quote character. // Find close quote character.
col_end = find_next_quote(line, col_start + 1, quotechar, col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
curbuf->b_p_qe);
if (col_end < 0) { if (col_end < 0) {
goto abort_search; goto abort_search;
} }
@ -4146,7 +4143,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
} }
} else { } else {
// Search backward for a starting quote. // Search backward for a starting quote.
col_start = find_prev_quote(line, col_start, quotechar, curbuf->b_p_qe); col_start = find_prev_quote(line, col_start, quotechar, (char_u *)curbuf->b_p_qe);
if (line[col_start] != quotechar) { if (line[col_start] != quotechar) {
// No quote before the cursor, look after the cursor. // No quote before the cursor, look after the cursor.
col_start = find_next_quote(line, col_start, quotechar, NULL); col_start = find_next_quote(line, col_start, quotechar, NULL);
@ -4156,8 +4153,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
} }
// Find close quote character. // Find close quote character.
col_end = find_next_quote(line, col_start + 1, quotechar, col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
curbuf->b_p_qe);
if (col_end < 0) { if (col_end < 0) {
goto abort_search; goto abort_search;
} }
@ -5375,7 +5371,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 : curbuf->b_p_inc; inc_opt = (*curbuf->b_p_inc == NUL) ? 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) {
@ -5385,7 +5381,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 : (char *)curbuf->b_p_def, ? (char *)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

@ -1837,7 +1837,7 @@ char *did_set_spelllang(win_T *wp)
// Make a copy of 'spelllang', the SpellFileMissing autocommands may change // Make a copy of 'spelllang', the SpellFileMissing autocommands may change
// it under our fingers. // it under our fingers.
spl_copy = vim_strsave(wp->w_s->b_p_spl); spl_copy = vim_strsave((char_u *)wp->w_s->b_p_spl);
wp->w_s->b_cjk = 0; wp->w_s->b_cjk = 0;
@ -1966,7 +1966,7 @@ char *did_set_spelllang(win_T *wp)
// round 1: load first name in 'spellfile'. // round 1: load first name in 'spellfile'.
// round 2: load second name in 'spellfile. // round 2: load second name in 'spellfile.
// etc. // etc.
spf = (char *)curwin->w_s->b_p_spf; spf = curwin->w_s->b_p_spf;
for (round = 0; round == 0 || *spf != NUL; round++) { for (round = 0; round == 0 || *spf != NUL; round++) {
if (round == 0) { if (round == 0) {
// Internal wordlist, if there is one. // Internal wordlist, if there is one.
@ -2120,13 +2120,13 @@ static void use_midword(slang_T *lp, win_T *wp)
wp->w_s->b_spell_ismw[c] = true; wp->w_s->b_spell_ismw[c] = true;
} else if (wp->w_s->b_spell_ismw_mb == NULL) { } else if (wp->w_s->b_spell_ismw_mb == NULL) {
// First multi-byte char in "b_spell_ismw_mb". // First multi-byte char in "b_spell_ismw_mb".
wp->w_s->b_spell_ismw_mb = vim_strnsave(p, (size_t)l); wp->w_s->b_spell_ismw_mb = (char *)vim_strnsave(p, (size_t)l);
} else { } else {
// Append multi-byte chars to "b_spell_ismw_mb". // Append multi-byte chars to "b_spell_ismw_mb".
const int n = (int)STRLEN(wp->w_s->b_spell_ismw_mb); const int n = (int)STRLEN(wp->w_s->b_spell_ismw_mb);
char_u *bp = vim_strnsave(wp->w_s->b_spell_ismw_mb, (size_t)n + (size_t)l); char_u *bp = vim_strnsave((char_u *)wp->w_s->b_spell_ismw_mb, (size_t)n + (size_t)l);
xfree(wp->w_s->b_spell_ismw_mb); xfree(wp->w_s->b_spell_ismw_mb);
wp->w_s->b_spell_ismw_mb = bp; wp->w_s->b_spell_ismw_mb = (char *)bp;
STRLCPY(bp + n, p, l + 1); STRLCPY(bp + n, p, l + 1);
} }
p += l; p += l;
@ -2359,7 +2359,7 @@ bool spell_iswordp(const char_u *p, const win_T *wp)
if (c < 256 if (c < 256
? wp->w_s->b_spell_ismw[c] ? wp->w_s->b_spell_ismw[c]
: (wp->w_s->b_spell_ismw_mb != NULL : (wp->w_s->b_spell_ismw_mb != NULL
&& vim_strchr((char *)wp->w_s->b_spell_ismw_mb, c) != NULL)) { && vim_strchr(wp->w_s->b_spell_ismw_mb, c) != NULL)) {
s = p + l; s = p + l;
} }
} }
@ -2405,7 +2405,7 @@ static bool spell_iswordp_w(const int *p, const win_T *wp)
if (*p < if (*p <
256 ? wp->w_s->b_spell_ismw[*p] : (wp->w_s->b_spell_ismw_mb != NULL 256 ? wp->w_s->b_spell_ismw[*p] : (wp->w_s->b_spell_ismw_mb != NULL
&& vim_strchr((char *)wp->w_s->b_spell_ismw_mb, && vim_strchr(wp->w_s->b_spell_ismw_mb,
*p) != NULL)) { *p) != NULL)) {
s = p + 1; s = p + 1;
} else { } else {
@ -3599,7 +3599,7 @@ char *compile_cap_prog(synblock_T *synblock)
synblock->b_cap_prog = NULL; synblock->b_cap_prog = NULL;
} else { } else {
// Prepend a ^ so that we only match at one column // Prepend a ^ so that we only match at one column
char_u *re = concat_str((char_u *)"^", synblock->b_p_spc); char_u *re = concat_str((char_u *)"^", (char_u *)synblock->b_p_spc);
synblock->b_cap_prog = vim_regcomp((char *)re, RE_MAGIC); synblock->b_cap_prog = vim_regcomp((char *)re, RE_MAGIC);
xfree(re); xfree(re);
if (synblock->b_cap_prog == NULL) { if (synblock->b_cap_prog == NULL) {

View File

@ -4877,12 +4877,12 @@ void ex_mkspell(exarg_T *eap)
{ {
int fcount; int fcount;
char **fnames; char **fnames;
char_u *arg = (char_u *)eap->arg; char *arg = eap->arg;
bool ascii = false; bool ascii = false;
if (STRNCMP(arg, "-ascii", 6) == 0) { if (STRNCMP(arg, "-ascii", 6) == 0) {
ascii = true; ascii = true;
arg = (char_u *)skipwhite((char *)arg + 6); arg = skipwhite(arg + 6);
} }
// Expand all the remaining arguments (e.g., $VIMRUNTIME). // Expand all the remaining arguments (e.g., $VIMRUNTIME).
@ -5552,7 +5552,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
} }
fnamebuf = xmalloc(MAXPATHL); fnamebuf = xmalloc(MAXPATHL);
for (spf = curwin->w_s->b_p_spf, i = 1; *spf != NUL; i++) { for (spf = (char_u *)curwin->w_s->b_p_spf, i = 1; *spf != NUL; i++) {
copy_option_part((char **)&spf, (char *)fnamebuf, MAXPATHL, ","); copy_option_part((char **)&spf, (char *)fnamebuf, MAXPATHL, ",");
if (i == idx) { if (i == idx) {
break; break;
@ -5680,14 +5680,14 @@ static void init_spellfile(void)
char_u *rtp; char_u *rtp;
char_u *lend; char_u *lend;
bool aspath = false; bool aspath = false;
char_u *lstart = curbuf->b_s.b_p_spl; char_u *lstart = (char_u *)curbuf->b_s.b_p_spl;
if (*curwin->w_s->b_p_spl != NUL && !GA_EMPTY(&curwin->w_s->b_langp)) { if (*curwin->w_s->b_p_spl != NUL && !GA_EMPTY(&curwin->w_s->b_langp)) {
buf = xmalloc(MAXPATHL); buf = xmalloc(MAXPATHL);
// Find the end of the language name. Exclude the region. If there // Find the end of the language name. Exclude the region. If there
// is a path separator remember the start of the tail. // is a path separator remember the start of the tail.
for (lend = curwin->w_s->b_p_spl; *lend != NUL for (lend = (char_u *)curwin->w_s->b_p_spl; *lend != NUL
&& vim_strchr(",._", *lend) == NULL; lend++) { && vim_strchr(",._", *lend) == NULL; lend++) {
if (vim_ispathsep(*lend)) { if (vim_ispathsep(*lend)) {
aspath = true; aspath = true;
@ -5702,8 +5702,7 @@ static void init_spellfile(void)
if (aspath) { if (aspath) {
// Use directory of an entry with path, e.g., for // Use directory of an entry with path, e.g., for
// "/dir/lg.utf-8.spl" use "/dir". // "/dir/lg.utf-8.spl" use "/dir".
STRLCPY(buf, curbuf->b_s.b_p_spl, STRLCPY(buf, curbuf->b_s.b_p_spl, lstart - (char_u *)curbuf->b_s.b_p_spl);
lstart - curbuf->b_s.b_p_spl);
} else { } else {
// Copy the path from 'runtimepath' to buf[]. // Copy the path from 'runtimepath' to buf[].
copy_option_part((char **)&rtp, (char *)buf, MAXPATHL, ","); copy_option_part((char **)&rtp, (char *)buf, MAXPATHL, ",");
@ -5712,8 +5711,7 @@ static void init_spellfile(void)
// Use the first language name from 'spelllang' and the // Use the first language name from 'spelllang' and the
// encoding used in the first loaded .spl file. // encoding used in the first loaded .spl file.
if (aspath) { if (aspath) {
STRLCPY(buf, curbuf->b_s.b_p_spl, STRLCPY(buf, curbuf->b_s.b_p_spl, lend - (char_u *)curbuf->b_s.b_p_spl + 1);
lend - curbuf->b_s.b_p_spl + 1);
} else { } else {
// Create the "spell" directory if it doesn't exist yet. // Create the "spell" directory if it doesn't exist yet.
l = (int)STRLEN(buf); l = (int)STRLEN(buf);

View File

@ -522,7 +522,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
use_sandbox = was_set_insecurely(wp, "rulerformat", 0); use_sandbox = was_set_insecurely(wp, "rulerformat", 0);
} else { } else {
if (*wp->w_p_stl != NUL) { if (*wp->w_p_stl != NUL) {
stl = wp->w_p_stl; stl = (char_u *)wp->w_p_stl;
} else { } else {
stl = p_stl; stl = p_stl;
} }

View File

@ -3162,7 +3162,7 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
msg_puts("\n"); msg_puts("\n");
if (curwin->w_s->b_syn_isk != empty_option) { if (curwin->w_s->b_syn_isk != empty_option) {
msg_puts("syntax iskeyword "); msg_puts("syntax iskeyword ");
msg_outtrans((char *)curwin->w_s->b_syn_isk); msg_outtrans(curwin->w_s->b_syn_isk);
} else { } else {
msg_outtrans(_("syntax iskeyword not set")); msg_outtrans(_("syntax iskeyword not set"));
} }
@ -3172,15 +3172,15 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
clear_string_option(&curwin->w_s->b_syn_isk); clear_string_option(&curwin->w_s->b_syn_isk);
} else { } else {
memmove(save_chartab, curbuf->b_chartab, (size_t)32); memmove(save_chartab, curbuf->b_chartab, (size_t)32);
save_isk = curbuf->b_p_isk; save_isk = (char_u *)curbuf->b_p_isk;
curbuf->b_p_isk = vim_strsave(arg); curbuf->b_p_isk = (char *)vim_strsave(arg);
buf_init_chartab(curbuf, false); buf_init_chartab(curbuf, false);
memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, (size_t)32); memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, (size_t)32);
memmove(curbuf->b_chartab, save_chartab, (size_t)32); memmove(curbuf->b_chartab, save_chartab, (size_t)32);
clear_string_option(&curwin->w_s->b_syn_isk); clear_string_option(&curwin->w_s->b_syn_isk);
curwin->w_s->b_syn_isk = curbuf->b_p_isk; curwin->w_s->b_syn_isk = curbuf->b_p_isk;
curbuf->b_p_isk = save_isk; curbuf->b_p_isk = (char *)save_isk;
} }
} }
redraw_later(curwin, UPD_NOT_VALID); redraw_later(curwin, UPD_NOT_VALID);
@ -5070,7 +5070,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
// Make 'cpoptions' empty, to avoid the 'l' flag // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo; cpo_save = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
ci->sp_prog = vim_regcomp((char *)ci->sp_pattern, RE_MAGIC); ci->sp_prog = vim_regcomp((char *)ci->sp_pattern, RE_MAGIC);
p_cpo = cpo_save; p_cpo = cpo_save;
@ -5226,14 +5226,14 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
if (!eap->skip) { if (!eap->skip) {
// store the pattern and compiled regexp program // store the pattern and compiled regexp program
curwin->w_s->b_syn_linecont_pat = curwin->w_s->b_syn_linecont_pat =
vim_strnsave(next_arg + 1, (size_t)(arg_end - (char *)next_arg) - 1); (char *)vim_strnsave(next_arg + 1, (size_t)(arg_end - (char *)next_arg) - 1);
curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic; curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic;
// Make 'cpoptions' empty, to avoid the 'l' flag // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo; cpo_save = p_cpo;
p_cpo = (char *)empty_option; p_cpo = empty_option;
curwin->w_s->b_syn_linecont_prog = curwin->w_s->b_syn_linecont_prog =
vim_regcomp((char *)curwin->w_s->b_syn_linecont_pat, RE_MAGIC); vim_regcomp(curwin->w_s->b_syn_linecont_pat, RE_MAGIC);
p_cpo = cpo_save; p_cpo = cpo_save;
syn_clear_time(&curwin->w_s->b_syn_linecont_time); syn_clear_time(&curwin->w_s->b_syn_linecont_time);

View File

@ -202,7 +202,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
} }
prev_num_matches = num_matches; prev_num_matches = num_matches;
free_string_option(nofile_fname); free_string_option((char *)nofile_fname);
nofile_fname = NULL; nofile_fname = NULL;
clearpos(&saved_fmark.mark); // shutup gcc 4.0 clearpos(&saved_fmark.mark); // shutup gcc 4.0
@ -215,7 +215,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
new_tag = true; new_tag = true;
if (g_do_tagpreview != 0) { if (g_do_tagpreview != 0) {
tagstack_clear_entry(&ptag_entry); tagstack_clear_entry(&ptag_entry);
ptag_entry.tagname = vim_strsave(tag); ptag_entry.tagname = (char *)vim_strsave(tag);
} }
} else { } else {
if (g_do_tagpreview != 0) { if (g_do_tagpreview != 0) {
@ -239,7 +239,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
cur_fnum = ptag_entry.cur_fnum; cur_fnum = ptag_entry.cur_fnum;
} else { } else {
tagstack_clear_entry(&ptag_entry); tagstack_clear_entry(&ptag_entry);
ptag_entry.tagname = vim_strsave(tag); ptag_entry.tagname = (char *)vim_strsave(tag);
} }
} else { } else {
/* /*
@ -261,7 +261,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
} }
// put the tag name in the tag stack // put the tag name in the tag stack
tagstack[tagstackidx].tagname = vim_strsave(tag); tagstack[tagstackidx].tagname = (char *)vim_strsave(tag);
curwin->w_tagstacklen = tagstacklen; curwin->w_tagstacklen = tagstacklen;
@ -440,9 +440,9 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// When desired match not found yet, try to find it (and others). // When desired match not found yet, try to find it (and others).
if (use_tagstack) { if (use_tagstack) {
name = tagstack[tagstackidx].tagname; name = (char_u *)tagstack[tagstackidx].tagname;
} else if (g_do_tagpreview != 0) { } else if (g_do_tagpreview != 0) {
name = ptag_entry.tagname; name = (char_u *)ptag_entry.tagname;
} else { } else {
name = tag; name = tag;
} }
@ -587,9 +587,9 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
if (use_tfu && parse_match((char_u *)matches[cur_match], &tagp2) == OK if (use_tfu && parse_match((char_u *)matches[cur_match], &tagp2) == OK
&& tagp2.user_data) { && tagp2.user_data) {
XFREE_CLEAR(tagstack[tagstackidx].user_data); XFREE_CLEAR(tagstack[tagstackidx].user_data);
tagstack[tagstackidx].user_data = vim_strnsave(tagp2.user_data, tagstack[tagstackidx].user_data = (char *)vim_strnsave(tagp2.user_data,
(size_t)(tagp2.user_data_end - (size_t)(tagp2.user_data_end -
tagp2.user_data)); tagp2.user_data));
} }
tagstackidx++; tagstackidx++;
@ -1184,7 +1184,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
flags & TAG_REGEXP ? "r": ""); flags & TAG_REGEXP ? "r": "");
save_pos = curwin->w_cursor; save_pos = curwin->w_cursor;
result = call_vim_function((char *)curbuf->b_p_tfu, 3, args, &rettv); result = call_vim_function(curbuf->b_p_tfu, 3, args, &rettv);
curwin->w_cursor = save_pos; // restore the cursor position curwin->w_cursor = save_pos; // restore the cursor position
d->dv_refcount--; d->dv_refcount--;
@ -2388,7 +2388,7 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
if (first) { if (first) {
// Init. We make a copy of 'tags', because autocommands may change // Init. We make a copy of 'tags', because autocommands may change
// the value without notifying us. // the value without notifying us.
tnp->tn_tags = vim_strsave((*curbuf->b_p_tags != NUL) ? curbuf->b_p_tags : p_tags); tnp->tn_tags = vim_strsave((*curbuf->b_p_tags != NUL) ? (char_u *)curbuf->b_p_tags : p_tags);
tnp->tn_np = (char *)tnp->tn_tags; tnp->tn_np = (char *)tnp->tn_tags;
} }
@ -3365,7 +3365,7 @@ static void tagstack_push_item(win_T *wp, char_u *tagname, int cur_fnum, int cur
} }
wp->w_tagstacklen++; wp->w_tagstacklen++;
tagstack[idx].tagname = tagname; tagstack[idx].tagname = (char *)tagname;
tagstack[idx].cur_fnum = cur_fnum; tagstack[idx].cur_fnum = cur_fnum;
tagstack[idx].cur_match = cur_match; tagstack[idx].cur_match = cur_match;
if (tagstack[idx].cur_match < 0) { if (tagstack[idx].cur_match < 0) {
@ -3373,7 +3373,7 @@ static void tagstack_push_item(win_T *wp, char_u *tagname, int cur_fnum, int cur
} }
tagstack[idx].fmark.mark = mark; tagstack[idx].fmark.mark = mark;
tagstack[idx].fmark.fnum = fnum; tagstack[idx].fmark.fnum = fnum;
tagstack[idx].user_data = user_data; tagstack[idx].user_data = (char *)user_data;
} }
// Add a list of items to the tag stack in the specified window // Add a list of items to the tag stack in the specified window

View File

@ -418,7 +418,7 @@ bool terminal_enter(void)
// placed at end of buffer to "follow" output. #11072 // placed at end of buffer to "follow" output. #11072
handle_T save_curwin = curwin->handle; handle_T save_curwin = curwin->handle;
bool save_w_p_cul = curwin->w_p_cul; bool save_w_p_cul = curwin->w_p_cul;
char_u *save_w_p_culopt = NULL; char *save_w_p_culopt = NULL;
char_u save_w_p_culopt_flags = curwin->w_p_culopt_flags; char_u save_w_p_culopt_flags = curwin->w_p_culopt_flags;
int save_w_p_cuc = curwin->w_p_cuc; int save_w_p_cuc = curwin->w_p_cuc;
long save_w_p_so = curwin->w_p_so; long save_w_p_so = curwin->w_p_so;
@ -426,7 +426,7 @@ bool terminal_enter(void)
if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) { if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) {
if (STRCMP(curwin->w_p_culopt, "number")) { if (STRCMP(curwin->w_p_culopt, "number")) {
save_w_p_culopt = curwin->w_p_culopt; save_w_p_culopt = curwin->w_p_culopt;
curwin->w_p_culopt = (char_u *)xstrdup("number"); curwin->w_p_culopt = xstrdup("number");
} }
curwin->w_p_culopt_flags = CULOPT_NBR; curwin->w_p_culopt_flags = CULOPT_NBR;
} else { } else {

View File

@ -457,7 +457,7 @@ void f_assert_exception(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
ga_clear(&ga); ga_clear(&ga);
rettv->vval.v_number = 1; rettv->vval.v_number = 1;
} else if (error != NULL } else if (error != NULL
&& strstr((char *)get_vim_var_str(VV_EXCEPTION), error) == NULL) { && strstr(get_vim_var_str(VV_EXCEPTION), error) == NULL) {
prepare_assert_error(&ga); prepare_assert_error(&ga);
fill_assert_error(&ga, &argvars[1], NULL, &argvars[0], fill_assert_error(&ga, &argvars[1], NULL, &argvars[0],
get_vim_var_tv(VV_EXCEPTION), ASSERT_OTHER); get_vim_var_tv(VV_EXCEPTION), ASSERT_OTHER);
@ -493,7 +493,7 @@ void f_assert_fails(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const char *const error = tv_get_string_buf_chk(&argvars[1], buf); const char *const error = tv_get_string_buf_chk(&argvars[1], buf);
if (error == NULL if (error == NULL
|| strstr((char *)get_vim_var_str(VV_ERRMSG), error) == NULL) { || strstr(get_vim_var_str(VV_ERRMSG), error) == NULL) {
prepare_assert_error(&ga); prepare_assert_error(&ga);
fill_assert_error(&ga, &argvars[2], NULL, &argvars[1], fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
get_vim_var_tv(VV_ERRMSG), ASSERT_OTHER); get_vim_var_tv(VV_ERRMSG), ASSERT_OTHER);

View File

@ -773,7 +773,7 @@ static bool serialize_header(bufinfo_T *bi, char_u *hash)
undo_write_bytes(bi, (uintmax_t)buf->b_ml.ml_line_count, 4); undo_write_bytes(bi, (uintmax_t)buf->b_ml.ml_line_count, 4);
size_t len = buf->b_u_line_ptr ? STRLEN(buf->b_u_line_ptr) : 0; size_t len = buf->b_u_line_ptr ? STRLEN(buf->b_u_line_ptr) : 0;
undo_write_bytes(bi, len, 4); undo_write_bytes(bi, len, 4);
if (len > 0 && !undo_write(bi, buf->b_u_line_ptr, len)) { if (len > 0 && !undo_write(bi, (char_u *)buf->b_u_line_ptr, len)) {
return false; return false;
} }
undo_write_bytes(bi, (uintmax_t)buf->b_u_line_lnum, 4); undo_write_bytes(bi, (uintmax_t)buf->b_u_line_lnum, 4);
@ -1593,7 +1593,7 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
curbuf->b_u_oldhead = old_idx < 0 ? NULL : uhp_table[old_idx]; curbuf->b_u_oldhead = old_idx < 0 ? NULL : uhp_table[old_idx];
curbuf->b_u_newhead = new_idx < 0 ? NULL : uhp_table[new_idx]; curbuf->b_u_newhead = new_idx < 0 ? NULL : uhp_table[new_idx];
curbuf->b_u_curhead = cur_idx < 0 ? NULL : uhp_table[cur_idx]; curbuf->b_u_curhead = cur_idx < 0 ? NULL : uhp_table[cur_idx];
curbuf->b_u_line_ptr = line_ptr; curbuf->b_u_line_ptr = (char *)line_ptr;
curbuf->b_u_line_lnum = line_lnum; curbuf->b_u_line_lnum = line_lnum;
curbuf->b_u_line_colnr = line_colnr; curbuf->b_u_line_colnr = line_colnr;
curbuf->b_u_numhead = num_head; curbuf->b_u_numhead = num_head;
@ -2960,7 +2960,7 @@ void u_saveline(linenr_T lnum)
} else { } else {
curbuf->b_u_line_colnr = 0; curbuf->b_u_line_colnr = 0;
} }
curbuf->b_u_line_ptr = u_save_line(lnum); curbuf->b_u_line_ptr = (char *)u_save_line(lnum);
} }
/// clear the line saved for the "U" command /// clear the line saved for the "U" command
@ -2992,12 +2992,12 @@ void u_undoline(void)
} }
char_u *oldp = u_save_line(curbuf->b_u_line_lnum); char_u *oldp = u_save_line(curbuf->b_u_line_lnum);
ml_replace(curbuf->b_u_line_lnum, (char *)curbuf->b_u_line_ptr, true); ml_replace(curbuf->b_u_line_lnum, curbuf->b_u_line_ptr, true);
changed_bytes(curbuf->b_u_line_lnum, 0); changed_bytes(curbuf->b_u_line_lnum, 0);
extmark_splice_cols(curbuf, (int)curbuf->b_u_line_lnum - 1, 0, (colnr_T)STRLEN(oldp), extmark_splice_cols(curbuf, (int)curbuf->b_u_line_lnum - 1, 0, (colnr_T)STRLEN(oldp),
(colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo); (colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo);
xfree(curbuf->b_u_line_ptr); xfree(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = oldp; curbuf->b_u_line_ptr = (char *)oldp;
colnr_T t = curbuf->b_u_line_colnr; colnr_T t = curbuf->b_u_line_colnr;
if (curwin->w_cursor.lnum == curbuf->b_u_line_lnum) { if (curwin->w_cursor.lnum == curbuf->b_u_line_lnum) {

View File

@ -2072,7 +2072,7 @@ void list_in_columns(char **items, int size, int current)
// Find the length of the longest item, use that + 1 as the column width. // Find the length of the longest item, use that + 1 as the column width.
int i; int i;
for (i = 0; size < 0 ? items[i] != NULL : i < size; i++) { for (i = 0; size < 0 ? items[i] != NULL : i < size; i++) {
int l = vim_strsize((char *)items[i]) + (i == current ? 2 : 0); int l = vim_strsize(items[i]) + (i == current ? 2 : 0);
if (l > width) { if (l > width) {
width = l; width = l;
@ -2084,7 +2084,7 @@ void list_in_columns(char **items, int size, int current)
if (Columns < width) { if (Columns < width) {
// Not enough screen columns - show one per line // Not enough screen columns - show one per line
for (i = 0; i < item_count; i++) { for (i = 0; i < item_count; i++) {
version_msg_wrap((char *)items[i], i == current); version_msg_wrap(items[i], i == current);
if (msg_col > 0 && i < item_count - 1) { if (msg_col > 0 && i < item_count - 1) {
msg_putchar('\n'); msg_putchar('\n');
} }
@ -2106,7 +2106,7 @@ void list_in_columns(char **items, int size, int current)
if (idx == current) { if (idx == current) {
msg_putchar('['); msg_putchar('[');
} }
msg_puts((char *)items[idx]); msg_puts(items[idx]);
if (idx == current) { if (idx == current) {
msg_putchar(']'); msg_putchar(']');
} }

View File

@ -727,38 +727,38 @@ void win_set_minimal_style(win_T *wp)
// Hide EOB region: use " " fillchar and cleared highlighting // Hide EOB region: use " " fillchar and cleared highlighting
if (wp->w_p_fcs_chars.eob != ' ') { if (wp->w_p_fcs_chars.eob != ' ') {
char_u *old = wp->w_p_fcs; char_u *old = (char_u *)wp->w_p_fcs;
wp->w_p_fcs = ((*old == NUL) wp->w_p_fcs = ((*old == NUL)
? (char_u *)xstrdup("eob: ") ? xstrdup("eob: ")
: concat_str(old, (char_u *)",eob: ")); : (char *)concat_str(old, (char_u *)",eob: "));
free_string_option(old); free_string_option((char *)old);
} }
// TODO(bfredl): this could use a highlight namespace directly, // TODO(bfredl): this could use a highlight namespace directly,
// and avoid pecularities around window options // and avoid pecularities around window options
char_u *old = wp->w_p_winhl; char_u *old = (char_u *)wp->w_p_winhl;
wp->w_p_winhl = ((*old == NUL) wp->w_p_winhl = ((*old == NUL)
? (char_u *)xstrdup("EndOfBuffer:") ? xstrdup("EndOfBuffer:")
: concat_str(old, (char_u *)",EndOfBuffer:")); : (char *)concat_str(old, (char_u *)",EndOfBuffer:"));
free_string_option(old); free_string_option((char *)old);
parse_winhl_opt(wp); parse_winhl_opt(wp);
// signcolumn: use 'auto' // signcolumn: use 'auto'
if (wp->w_p_scl[0] != 'a' || STRLEN(wp->w_p_scl) >= 8) { if (wp->w_p_scl[0] != 'a' || STRLEN(wp->w_p_scl) >= 8) {
free_string_option(wp->w_p_scl); free_string_option(wp->w_p_scl);
wp->w_p_scl = (char_u *)xstrdup("auto"); wp->w_p_scl = xstrdup("auto");
} }
// foldcolumn: use '0' // foldcolumn: use '0'
if (wp->w_p_fdc[0] != '0') { if (wp->w_p_fdc[0] != '0') {
free_string_option(wp->w_p_fdc); free_string_option(wp->w_p_fdc);
wp->w_p_fdc = (char_u *)xstrdup("0"); wp->w_p_fdc = xstrdup("0");
} }
// colorcolumn: cleared // colorcolumn: cleared
if (wp->w_p_cc != NULL && *wp->w_p_cc != NUL) { if (wp->w_p_cc != NULL && *wp->w_p_cc != NUL) {
free_string_option(wp->w_p_cc); free_string_option(wp->w_p_cc);
wp->w_p_cc = (char_u *)xstrdup(""); wp->w_p_cc = xstrdup("");
} }
} }
@ -1570,10 +1570,10 @@ static void win_init(win_T *newp, win_T *oldp, int flags)
taggy_T *tag = &newp->w_tagstack[i]; taggy_T *tag = &newp->w_tagstack[i];
*tag = oldp->w_tagstack[i]; *tag = oldp->w_tagstack[i];
if (tag->tagname != NULL) { if (tag->tagname != NULL) {
tag->tagname = vim_strsave(tag->tagname); tag->tagname = xstrdup(tag->tagname);
} }
if (tag->user_data != NULL) { if (tag->user_data != NULL) {
tag->user_data = vim_strsave(tag->user_data); tag->user_data = xstrdup(tag->user_data);
} }
} }
newp->w_tagstackidx = oldp->w_tagstackidx; newp->w_tagstackidx = oldp->w_tagstackidx;
@ -7291,7 +7291,7 @@ char *check_colorcolumn(win_T *wp)
return NULL; // buffer was closed return NULL; // buffer was closed
} }
for (s = (char *)wp->w_p_cc; *s != NUL && count < 255;) { for (s = wp->w_p_cc; *s != NUL && count < 255;) {
if (*s == '-' || *s == '+') { if (*s == '-' || *s == '+') {
// -N and +N: add to 'textwidth' // -N and +N: add to 'textwidth'
col = (*s == '-') ? -1 : 1; col = (*s == '-') ? -1 : 1;