mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: replace char_u with char
Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
parent
22f9200302
commit
40855b0143
@ -1031,7 +1031,7 @@ String nvim_buf_get_name(Buffer buffer, Arena *arena, Error *err)
|
||||
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
|
||||
|
@ -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
|
||||
if (mark->fmark.fnum != 0) {
|
||||
bufnr = mark->fmark.fnum;
|
||||
filename = (char *)buflist_nr2name(bufnr, true, true);
|
||||
filename = buflist_nr2name(bufnr, true, true);
|
||||
allocated = true;
|
||||
// Marks comes from shada
|
||||
} 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,
|
||||
// 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;
|
||||
grpname = get_default_stl_hl(wp, use_winbar);
|
||||
|
||||
|
@ -157,7 +157,7 @@ void alist_add(alist_T *al, char *fname, int set_fnum)
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
slash_adjust(fname);
|
||||
#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) {
|
||||
AARGLIST(al)[al->al_ga.ga_len].ae_fnum =
|
||||
buflist_add(fname, BLN_LISTED | (set_fnum == 2 ? BLN_CURBUF : 0));
|
||||
@ -226,7 +226,7 @@ static char *do_one_arg(char *str)
|
||||
/// growarray "gap".
|
||||
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) {
|
||||
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'.
|
||||
///
|
||||
/// @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;
|
||||
int i;
|
||||
|
||||
get_arglist(&ga, (char *)str, true);
|
||||
get_arglist(&ga, str, true);
|
||||
|
||||
if (wig) {
|
||||
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++) {
|
||||
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);
|
||||
}
|
||||
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);
|
||||
xfree(p);
|
||||
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);
|
||||
@ -472,7 +472,7 @@ void ex_args(exarg_T *eap)
|
||||
} else if (eap->cmdidx == CMD_args) {
|
||||
// ":args": list arguments.
|
||||
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
|
||||
// required and no wait_return().
|
||||
gotocmdline(true);
|
||||
@ -489,10 +489,8 @@ void ex_args(exarg_T *eap)
|
||||
ga_grow(gap, GARGCOUNT);
|
||||
for (int i = 0; i < GARGCOUNT; i++) {
|
||||
if (GARGLIST[i].ae_fname != NULL) {
|
||||
AARGLIST(curwin->w_alist)[gap->ga_len].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_fname = xstrdup(GARGLIST[i].ae_fname);
|
||||
AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum = GARGLIST[i].ae_fnum;
|
||||
gap->ga_len++;
|
||||
}
|
||||
}
|
||||
@ -742,7 +740,7 @@ char *alist_name(aentry_T *aep)
|
||||
// Use the name from the associated buffer if it exists.
|
||||
bp = buflist_findnr(aep->ae_fnum);
|
||||
if (bp == NULL || bp->b_fname == NULL) {
|
||||
return (char *)aep->ae_fname;
|
||||
return aep->ae_fname;
|
||||
}
|
||||
return bp->b_fname;
|
||||
}
|
||||
|
@ -1720,9 +1720,9 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
fname = NULL;
|
||||
} else {
|
||||
if (event == EVENT_SYNTAX) {
|
||||
fname = (char *)buf->b_p_syn;
|
||||
fname = buf->b_p_syn;
|
||||
} else if (event == EVENT_FILETYPE) {
|
||||
fname = (char *)buf->b_p_ft;
|
||||
fname = buf->b_p_ft;
|
||||
} else {
|
||||
if (buf->b_sfname != NULL) {
|
||||
sfname = xstrdup(buf->b_sfname);
|
||||
|
@ -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.
|
||||
*/
|
||||
typedef struct taggy {
|
||||
char_u *tagname; // tag name
|
||||
char *tagname; // tag name
|
||||
fmark_T fmark; // cursor position BEFORE ":tag"
|
||||
int cur_match; // match number
|
||||
int cur_fnum; // buffer number used for cur_match
|
||||
char_u *user_data; // used with tagfunc
|
||||
char *user_data; // used with tagfunc
|
||||
} taggy_T;
|
||||
|
||||
typedef struct buffblock buffblock_T;
|
||||
@ -131,7 +131,7 @@ typedef struct buffheader buffheader_T;
|
||||
*/
|
||||
struct 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'
|
||||
int wo_bri;
|
||||
#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'
|
||||
int wo_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'
|
||||
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
|
||||
int wo_fen;
|
||||
#define w_p_fen w_onebuf_opt.wo_fen // 'foldenable'
|
||||
int wo_fen_save;
|
||||
// 'foldenable' saved for diff mode
|
||||
#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'
|
||||
long wo_fdl;
|
||||
#define w_p_fdl w_onebuf_opt.wo_fdl // 'foldlevel'
|
||||
long wo_fdl_save;
|
||||
// 'foldlevel' state saved for diff mode
|
||||
#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'
|
||||
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
|
||||
long wo_fml;
|
||||
#define w_p_fml w_onebuf_opt.wo_fml // 'foldminlines'
|
||||
long wo_fdn;
|
||||
#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'
|
||||
char_u *wo_fdt;
|
||||
char *wo_fdt;
|
||||
#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'
|
||||
int wo_lbr;
|
||||
#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'
|
||||
int wo_rnu;
|
||||
#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'
|
||||
unsigned wo_ve_flags;
|
||||
#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'
|
||||
int wo_rl;
|
||||
#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'
|
||||
long wo_scr;
|
||||
#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'
|
||||
int wo_cul;
|
||||
#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'
|
||||
char_u *wo_cc;
|
||||
char *wo_cc;
|
||||
#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'
|
||||
char_u *wo_stl;
|
||||
char *wo_stl;
|
||||
#define w_p_stl w_onebuf_opt.wo_stl // 'statusline'
|
||||
char *wo_wbr;
|
||||
#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'
|
||||
int wo_wrap_save; // 'wrap' state saved for diff mode
|
||||
#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
|
||||
long wo_cole; // 'conceallevel'
|
||||
#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'
|
||||
int wo_crb_save; // 'cursorbind' state saved for diff mode
|
||||
#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'
|
||||
char_u *wo_winhl;
|
||||
char *wo_winhl;
|
||||
#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'
|
||||
char_u *wo_lcs;
|
||||
char *wo_lcs;
|
||||
#define w_p_lcs w_onebuf_opt.wo_lcs // 'listchars'
|
||||
long wo_winbl;
|
||||
#define w_p_winbl w_onebuf_opt.wo_winbl // 'winblend'
|
||||
@ -308,7 +308,7 @@ typedef struct arglist {
|
||||
//
|
||||
// TODO(Felipe): move aentry_T to another header
|
||||
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
|
||||
} aentry_T;
|
||||
|
||||
@ -326,7 +326,7 @@ typedef struct argentry {
|
||||
*/
|
||||
typedef struct {
|
||||
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_off; // current position in tb_buf[]
|
||||
int tb_len; // number of valid bytes in tb_buf[]
|
||||
@ -354,8 +354,8 @@ typedef struct mapblock mapblock_T;
|
||||
struct mapblock {
|
||||
mapblock_T *m_next; // next mapblock in list
|
||||
char_u *m_keys; // mapped from, lhs
|
||||
char_u *m_str; // mapped to, rhs
|
||||
char_u *m_orig_str; // rhs as entered by the user
|
||||
char *m_str; // mapped to, rhs
|
||||
char *m_orig_str; // rhs as entered by the user
|
||||
LuaRef m_luaref; // lua function reference as rhs
|
||||
int m_keylen; // strlen(m_keys)
|
||||
int m_mode; // valid mode
|
||||
@ -447,7 +447,7 @@ typedef struct {
|
||||
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_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
|
||||
syn_time_T b_syn_linecont_time;
|
||||
int b_syn_linecont_ic; // ignore-case flag for above
|
||||
@ -478,15 +478,15 @@ typedef struct {
|
||||
// for spell checking
|
||||
garray_T b_langp; // list of pointers to slang_T, see spell.c
|
||||
bool b_spell_ismw[256]; // flags: is midword char
|
||||
char_u *b_spell_ismw_mb; // multi-byte midword chars
|
||||
char_u *b_p_spc; // 'spellcapcheck'
|
||||
char *b_spell_ismw_mb; // multi-byte midword chars
|
||||
char *b_p_spc; // 'spellcapcheck'
|
||||
regprog_T *b_cap_prog; // program for 'spellcapcheck'
|
||||
char_u *b_p_spf; // 'spellfile'
|
||||
char_u *b_p_spl; // 'spelllang'
|
||||
char_u *b_p_spo; // 'spelloptions'
|
||||
char *b_p_spf; // 'spellfile'
|
||||
char *b_p_spl; // 'spelllang'
|
||||
char *b_p_spo; // 'spelloptions'
|
||||
int b_cjk; // all CJK letters as OK
|
||||
char_u b_syn_chartab[32]; // syntax iskeyword option
|
||||
char_u *b_syn_isk; // iskeyword option
|
||||
uint8_t b_syn_chartab[32]; // syntax iskeyword option
|
||||
char *b_syn_isk; // iskeyword option
|
||||
} synblock_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
|
||||
long b_u_save_nr_cur; // file write nr after which we are now
|
||||
|
||||
/*
|
||||
* variables for "U" command in undo.c
|
||||
*/
|
||||
char_u *b_u_line_ptr; // saved line for "U" command
|
||||
// variables for "U" command in undo.c
|
||||
char *b_u_line_ptr; // saved line for "U" command
|
||||
linenr_T b_u_line_lnum; // line number of line in u_line
|
||||
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_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
|
||||
int b_p_ci; ///< 'copyindent'
|
||||
int b_p_bin; ///< 'binary'
|
||||
int b_p_bomb; ///< 'bomb'
|
||||
char_u *b_p_bh; ///< 'bufhidden'
|
||||
char_u *b_p_bt; ///< 'buftype'
|
||||
char *b_p_bh; ///< 'bufhidden'
|
||||
char *b_p_bt; ///< 'buftype'
|
||||
int b_has_qf_entry; ///< quickfix exists for buffer
|
||||
int b_p_bl; ///< 'buflisted'
|
||||
long b_p_channel; ///< 'channel'
|
||||
int b_p_cin; ///< 'cindent'
|
||||
char_u *b_p_cino; ///< 'cinoptions'
|
||||
char_u *b_p_cink; ///< 'cinkeys'
|
||||
char_u *b_p_cinw; ///< 'cinwords'
|
||||
char_u *b_p_cinsd; ///< 'cinscopedecls'
|
||||
char_u *b_p_com; ///< 'comments'
|
||||
char_u *b_p_cms; ///< 'commentstring'
|
||||
char_u *b_p_cpt; ///< 'complete'
|
||||
char *b_p_cino; ///< 'cinoptions'
|
||||
char *b_p_cink; ///< 'cinkeys'
|
||||
char *b_p_cinw; ///< 'cinwords'
|
||||
char *b_p_cinsd; ///< 'cinscopedecls'
|
||||
char *b_p_com; ///< 'comments'
|
||||
char *b_p_cms; ///< 'commentstring'
|
||||
char *b_p_cpt; ///< 'complete'
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
char_u *b_p_csl; ///< 'completeslash'
|
||||
#endif
|
||||
char_u *b_p_cfu; ///< 'completefunc'
|
||||
char_u *b_p_ofu; ///< 'omnifunc'
|
||||
char_u *b_p_tfu; ///< 'tagfunc'
|
||||
char *b_p_cfu; ///< 'completefunc'
|
||||
char *b_p_ofu; ///< 'omnifunc'
|
||||
char *b_p_tfu; ///< 'tagfunc'
|
||||
int b_p_eol; ///< 'endofline'
|
||||
int b_p_fixeol; ///< 'fixendofline'
|
||||
int b_p_et; ///< 'expandtab'
|
||||
int b_p_et_nobin; ///< b_p_et saved for binary mode
|
||||
int b_p_et_nopaste; ///< b_p_et saved for paste mode
|
||||
char_u *b_p_fenc; ///< 'fileencoding'
|
||||
char_u *b_p_ff; ///< 'fileformat'
|
||||
char_u *b_p_ft; ///< 'filetype'
|
||||
char_u *b_p_fo; ///< 'formatoptions'
|
||||
char_u *b_p_flp; ///< 'formatlistpat'
|
||||
char *b_p_fenc; ///< 'fileencoding'
|
||||
char *b_p_ff; ///< 'fileformat'
|
||||
char *b_p_ft; ///< 'filetype'
|
||||
char *b_p_fo; ///< 'formatoptions'
|
||||
char *b_p_flp; ///< 'formatlistpat'
|
||||
int b_p_inf; ///< 'infercase'
|
||||
char_u *b_p_isk; ///< 'iskeyword'
|
||||
char_u *b_p_def; ///< 'define' local value
|
||||
char_u *b_p_inc; ///< 'include'
|
||||
char_u *b_p_inex; ///< 'includeexpr'
|
||||
char *b_p_isk; ///< 'iskeyword'
|
||||
char *b_p_def; ///< 'define' local value
|
||||
char *b_p_inc; ///< 'include'
|
||||
char *b_p_inex; ///< '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'
|
||||
char_u *b_p_indk; ///< 'indentkeys'
|
||||
char_u *b_p_fp; ///< 'formatprg'
|
||||
char_u *b_p_fex; ///< 'formatexpr'
|
||||
char *b_p_indk; ///< 'indentkeys'
|
||||
char *b_p_fp; ///< 'formatprg'
|
||||
char *b_p_fex; ///< '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'
|
||||
char_u *b_p_menc; ///< 'makeencoding'
|
||||
char_u *b_p_mps; ///< 'matchpairs'
|
||||
char *b_p_menc; ///< 'makeencoding'
|
||||
char *b_p_mps; ///< 'matchpairs'
|
||||
int b_p_ml; ///< 'modeline'
|
||||
int b_p_ml_nobin; ///< b_p_ml saved for binary mode
|
||||
int b_p_ma; ///< 'modifiable'
|
||||
char_u *b_p_nf; ///< 'nrformats'
|
||||
char *b_p_nf; ///< 'nrformats'
|
||||
int b_p_pi; ///< 'preserveindent'
|
||||
char_u *b_p_qe; ///< 'quoteescape'
|
||||
char *b_p_qe; ///< 'quoteescape'
|
||||
int b_p_ro; ///< 'readonly'
|
||||
long b_p_sw; ///< 'shiftwidth'
|
||||
long b_p_scbk; ///< 'scrollback'
|
||||
int b_p_si; ///< 'smartindent'
|
||||
long b_p_sts; ///< 'softtabstop'
|
||||
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'
|
||||
long b_p_smc; ///< 'synmaxcol'
|
||||
char_u *b_p_syn; ///< 'syntax'
|
||||
char *b_p_syn; ///< 'syntax'
|
||||
long b_p_ts; ///< 'tabstop'
|
||||
long b_p_tw; ///< 'textwidth'
|
||||
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_nobin; ///< b_p_wm saved for binary 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
|
||||
char_u *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode
|
||||
char_u *b_p_vts; ///< 'vartabstop'
|
||||
char *b_p_vsts_nopaste; ///< b_p_vsts saved for paste mode
|
||||
char *b_p_vts; ///< 'vartabstop'
|
||||
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
|
||||
char_u *b_p_gp; ///< 'grepprg' local value
|
||||
char_u *b_p_mp; ///< 'makeprg' local value
|
||||
char_u *b_p_efm; ///< 'errorformat' local value
|
||||
char_u *b_p_ep; ///< 'equalprg' local value
|
||||
char_u *b_p_path; ///< 'path' local value
|
||||
char *b_p_gp; ///< 'grepprg' local value
|
||||
char *b_p_mp; ///< 'makeprg' local value
|
||||
char *b_p_efm; ///< 'errorformat' local value
|
||||
char *b_p_ep; ///< 'equalprg' local value
|
||||
char *b_p_path; ///< 'path' local value
|
||||
int b_p_ar; ///< 'autoread' local value
|
||||
char_u *b_p_tags; ///< 'tags' local value
|
||||
char_u *b_p_tc; ///< 'tagcase' local value
|
||||
char *b_p_tags; ///< 'tags' local value
|
||||
char *b_p_tc; ///< 'tagcase' local value
|
||||
unsigned b_tc_flags; ///< flags for 'tagcase'
|
||||
char_u *b_p_dict; ///< 'dictionary' local value
|
||||
char_u *b_p_tsr; ///< 'thesaurus' local value
|
||||
char_u *b_p_tsrfu; ///< 'thesaurusfunc' local value
|
||||
char *b_p_dict; ///< 'dictionary' local value
|
||||
char *b_p_tsr; ///< 'thesaurus' local value
|
||||
char *b_p_tsrfu; ///< 'thesaurusfunc' local value
|
||||
long b_p_ul; ///< 'undolevels' local value
|
||||
int b_p_udf; ///< 'undofile'
|
||||
char_u *b_p_lw; ///< 'lispwords' local value
|
||||
char *b_p_lw; ///< 'lispwords' local value
|
||||
|
||||
// end of buffer options
|
||||
|
||||
|
@ -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.
|
||||
/// 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.
|
||||
@ -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.
|
||||
// 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--;
|
||||
}
|
||||
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_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
|
||||
curwin->w_cursor.col = 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);
|
||||
next_line = NULL;
|
||||
}
|
||||
@ -1814,16 +1814,16 @@ theend:
|
||||
/// If "fixpos" is true fix the cursor position when done.
|
||||
void truncate_line(int fixpos)
|
||||
{
|
||||
char_u *newp;
|
||||
char *newp;
|
||||
linenr_T lnum = curwin->w_cursor.lnum;
|
||||
colnr_T col = curwin->w_cursor.col;
|
||||
|
||||
if (col == 0) {
|
||||
newp = vim_strsave((char_u *)"");
|
||||
newp = xstrdup("");
|
||||
} 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
|
||||
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) {
|
||||
// scan through the 'comments' option for a match
|
||||
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
|
||||
// one. Put "string" at start of string.
|
||||
if (!got_com && flags != NULL) {
|
||||
@ -2037,7 +2037,7 @@ int get_last_leader_offset(char *line, char **flags)
|
||||
while (--i >= lower_check_bound) {
|
||||
// scan through the 'comments' option for a match
|
||||
int found_one = false;
|
||||
for (list = (char *)curbuf->b_p_com; *list;) {
|
||||
for (list = curbuf->b_p_com; *list;) {
|
||||
char *flags_save = list;
|
||||
|
||||
// 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);
|
||||
|
||||
for (list = (char *)curbuf->b_p_com; *list;) {
|
||||
for (list = curbuf->b_p_com; *list;) {
|
||||
char *flags_save = list;
|
||||
|
||||
(void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ",");
|
||||
|
@ -149,7 +149,7 @@ int buf_init_chartab(buf_T *buf, int global)
|
||||
p = p_isf;
|
||||
} else { // i == 3
|
||||
// fourth round: 'iskeyword'
|
||||
p = buf->b_p_isk;
|
||||
p = (char_u *)buf->b_p_isk;
|
||||
}
|
||||
|
||||
while (*p) {
|
||||
|
@ -797,8 +797,8 @@ static int diff_write(buf_T *buf, diffin_T *din)
|
||||
}
|
||||
|
||||
// Always use 'fileformat' set to "unix".
|
||||
char_u *save_ff = buf->b_p_ff;
|
||||
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX);
|
||||
char *save_ff = buf->b_p_ff;
|
||||
buf->b_p_ff = xstrdup(FF_UNIX);
|
||||
const bool save_cmod_flags = cmdmod.cmod_flags;
|
||||
// Writing the buffer is an implementation detail of performing the diff,
|
||||
// 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) {
|
||||
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);
|
||||
|
||||
@ -1424,12 +1424,12 @@ void diff_win_options(win_T *wp, int addbuf)
|
||||
if (wp->w_p_diff_saved) {
|
||||
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);
|
||||
wp->w_p_fdc = (char_u *)xstrdup("2");
|
||||
wp->w_p_fdc = xstrdup("2");
|
||||
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_fdl = 0;
|
||||
foldUpdateAll(wp);
|
||||
@ -1480,11 +1480,9 @@ void ex_diffoff(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
free_string_option(wp->w_p_fdm);
|
||||
wp->w_p_fdm = vim_strsave(*wp->w_p_fdm_save
|
||||
? wp->w_p_fdm_save
|
||||
: (char_u *)"manual");
|
||||
wp->w_p_fdm = xstrdup(*wp->w_p_fdm_save ? wp->w_p_fdm_save : "manual");
|
||||
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) {
|
||||
wp->w_p_fdl = wp->w_p_fdl_save;
|
||||
|
@ -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
|
||||
&& (wp != curwin || lnum != wp->w_cursor.lnum || conceal_cursor_line(wp))
|
||||
&& ((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;
|
||||
if (((prev_syntax_id != syntax_seqnr && (syntax_flags & HL_CONCEAL) != 0)
|
||||
|| has_match_conc > 1 || decor_conceal > 1)
|
||||
|
@ -1780,7 +1780,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
|
||||
backspace_until_column(0);
|
||||
|
||||
// Insert new stuff into line again
|
||||
ins_bytes(new_line);
|
||||
ins_bytes((char *)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) {
|
||||
// In MODE_VREPLACE state we have backspaced over the text to be
|
||||
// moved, now we re-insert it into the new line.
|
||||
ins_bytes(saved_text);
|
||||
ins_bytes((char *)saved_text);
|
||||
xfree(saved_text);
|
||||
} else {
|
||||
/*
|
||||
@ -3689,9 +3689,9 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
|
||||
}
|
||||
|
||||
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 {
|
||||
look = curbuf->b_p_cink; // 'indentexpr' empty: use 'cinkeys'
|
||||
look = (char_u *)curbuf->b_p_cink; // 'indentexpr' empty: use 'cinkeys'
|
||||
}
|
||||
while (*look) {
|
||||
/*
|
||||
|
@ -2192,7 +2192,7 @@ int pattern_match(char *pat, char *text, bool ic)
|
||||
|
||||
// avoid 'l' flag in 'cpoptions'
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
|
||||
if (regmatch.regprog != NULL) {
|
||||
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
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
|
||||
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);
|
||||
ga_clear(&ga);
|
||||
if ((char_u *)p_cpo == empty_option) {
|
||||
if (p_cpo == empty_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// 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) {
|
||||
set_option_value_give_err("cpo", 0L, save_cpo, 0);
|
||||
}
|
||||
free_string_option((char_u *)save_cpo);
|
||||
free_string_option(save_cpo);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -591,7 +591,7 @@ buf_T *tv_get_buf(typval_T *tv, int curtab_only)
|
||||
int save_magic = p_magic;
|
||||
p_magic = true;
|
||||
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),
|
||||
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)
|
||||
{
|
||||
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;
|
||||
bool first = true;
|
||||
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 == FINDFILE_DIR
|
||||
? (char_u *)""
|
||||
: curbuf->b_p_sua));
|
||||
: (char_u *)curbuf->b_p_sua));
|
||||
first = false;
|
||||
|
||||
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.
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
switch (type) {
|
||||
@ -6312,7 +6312,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
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
|
||||
# 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.
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
|
||||
// Set the time limit, if there is one.
|
||||
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(pat3);
|
||||
if ((char_u *)p_cpo == empty_option) {
|
||||
if (p_cpo == empty_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// 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) {
|
||||
set_option_value_give_err("cpo", 0L, save_cpo, 0);
|
||||
}
|
||||
free_string_option((char_u *)save_cpo);
|
||||
free_string_option(save_cpo);
|
||||
}
|
||||
|
||||
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.
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
|
||||
const char *str = tv_get_string(&argvars[0]);
|
||||
const char *pat = NULL;
|
||||
|
@ -680,11 +680,11 @@ void ex_listdo(exarg_T *eap)
|
||||
// buffer was opened while Syntax autocommands were disabled,
|
||||
// need to trigger them now.
|
||||
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);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2602,7 +2602,7 @@ void undo_cmdmod(cmdmod_T *cmod)
|
||||
if (cmod->cmod_save_ei != NULL) {
|
||||
// Restore 'eventignore' to the value before ":noautocmd".
|
||||
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;
|
||||
}
|
||||
|
||||
@ -3646,8 +3646,8 @@ char *replace_makeprg(exarg_T *eap, char *arg, char **cmdlinep)
|
||||
// Don't do it when ":vimgrep" is used for ":grep".
|
||||
if ((eap->cmdidx == CMD_make || eap->cmdidx == CMD_lmake || isgrep)
|
||||
&& !grep_internal(eap->cmdidx)) {
|
||||
const char *program = isgrep ? (*curbuf->b_p_gp == NUL ? (char *)p_gp : (char *)curbuf->b_p_gp)
|
||||
: (*curbuf->b_p_mp == NUL ? (char *)p_mp : (char *)curbuf->b_p_mp);
|
||||
const char *program = isgrep ? (*curbuf->b_p_gp == NUL ? (char *)p_gp : curbuf->b_p_gp)
|
||||
: (*curbuf->b_p_mp == NUL ? (char *)p_mp : curbuf->b_p_mp);
|
||||
|
||||
arg = skipwhite(arg);
|
||||
|
||||
|
@ -1376,7 +1376,7 @@ void ex_catch(exarg_T *eap)
|
||||
*end = NUL;
|
||||
}
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
// Disable error messages, it will make current exception
|
||||
// invalid
|
||||
emsg_off++;
|
||||
|
@ -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
|
||||
// the options, even when "options" is not in 'sessionoptions'.
|
||||
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
|
||||
|
@ -827,7 +827,7 @@ char_u *vim_findfile(void *search_ctx_arg)
|
||||
if (search_ctx->ffsc_tagfile) {
|
||||
suf = "";
|
||||
} else {
|
||||
suf = (char *)curbuf->b_p_sua;
|
||||
suf = curbuf->b_p_sua;
|
||||
}
|
||||
for (;;) {
|
||||
// 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,
|
||||
(*curbuf->b_p_path == NUL
|
||||
? p_path
|
||||
: curbuf->b_p_path),
|
||||
FINDFILE_BOTH, rel_fname, curbuf->b_p_sua);
|
||||
: (char_u *)curbuf->b_p_path),
|
||||
FINDFILE_BOTH, rel_fname, (char_u *)curbuf->b_p_sua);
|
||||
}
|
||||
|
||||
static char_u *ff_file_to_find = NULL;
|
||||
|
@ -708,7 +708,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
|
||||
|
||||
fenc_alloced = false;
|
||||
} 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;
|
||||
} else {
|
||||
fenc_next = (char *)p_fencs; // try items in 'fileencodings'
|
||||
@ -1948,7 +1948,7 @@ failed:
|
||||
if (!au_did_filetype && *curbuf->b_p_ft != NUL) {
|
||||
// EVENT_FILETYPE was not triggered but the buffer already has a
|
||||
// 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 {
|
||||
apply_autocmds_exarg(EVENT_FILEREADPOST, sfname, sfname,
|
||||
@ -3052,7 +3052,7 @@ nobackup:
|
||||
fenc = (char *)enc_canonize((char_u *)fenc);
|
||||
fenc_tofree = fenc;
|
||||
} else {
|
||||
fenc = (char *)buf->b_p_fenc;
|
||||
fenc = buf->b_p_fenc;
|
||||
}
|
||||
|
||||
// Check if the file needs to be converted.
|
||||
|
@ -1556,7 +1556,7 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
|
||||
}
|
||||
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);
|
||||
|
||||
// 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`.
|
||||
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 *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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
foldDelMarker(wp->w_buffer, fp->fd_top + lnum_off + fp->fd_len - 1,
|
||||
foldendmarker, foldendmarkerlen);
|
||||
@ -1639,7 +1639,7 @@ static void foldDelMarker(buf_T *buf, linenr_T lnum, char_u *marker, size_t mark
|
||||
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);
|
||||
for (char_u *p = line; *p != NUL; p++) {
|
||||
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
|
||||
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));
|
||||
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)
|
||||
{
|
||||
// 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);
|
||||
while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1])) {
|
||||
cms_slen--;
|
||||
@ -2854,7 +2854,7 @@ static void foldlevelIndent(fline_T *flp)
|
||||
|
||||
// empty line or lines starting with a character in 'foldignore': level
|
||||
// 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
|
||||
if (lnum == 1 || lnum == buf->b_ml.ml_line_count) {
|
||||
flp->lvl = 0;
|
||||
@ -2907,7 +2907,7 @@ static void foldlevelExpr(fline_T *flp)
|
||||
const bool save_keytyped = KeyTyped;
|
||||
|
||||
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;
|
||||
|
||||
switch (c) {
|
||||
@ -2985,8 +2985,8 @@ static void foldlevelExpr(fline_T *flp)
|
||||
/// Relies on the option value to have been checked for correctness already.
|
||||
static void parseMarker(win_T *wp)
|
||||
{
|
||||
foldendmarker = (char_u *)vim_strchr((char *)wp->w_p_fmr, ',');
|
||||
foldstartmarkerlen = (size_t)(foldendmarker++ - wp->w_p_fmr);
|
||||
foldendmarker = (char_u *)vim_strchr(wp->w_p_fmr, ',');
|
||||
foldstartmarkerlen = (size_t)(foldendmarker++ - (char_u *)wp->w_p_fmr);
|
||||
foldendmarkerlen = STRLEN(foldendmarker);
|
||||
}
|
||||
|
||||
@ -3003,7 +3003,7 @@ static void foldlevelMarker(fline_T *flp)
|
||||
int start_lvl = flp->lvl;
|
||||
|
||||
// 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;
|
||||
startmarker++;
|
||||
int cend = *foldendmarker;
|
||||
|
@ -162,7 +162,7 @@ static char_u *get_buffcont(buffheader_T *buffer, int dozero)
|
||||
p2 = p;
|
||||
for (const buffblock_T *bp = buffer->bh_first.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++;
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ static int read_readbuf(buffheader_T *buf, int advance)
|
||||
}
|
||||
|
||||
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 (curr->b_str[++buf->bh_index] == NUL) {
|
||||
@ -649,7 +649,7 @@ static int read_redo(bool init, bool old_redo)
|
||||
if (bp == NULL) {
|
||||
return FAIL;
|
||||
}
|
||||
p = bp->b_str;
|
||||
p = (char_u *)bp->b_str;
|
||||
return OK;
|
||||
}
|
||||
if ((c = *p) == NUL) {
|
||||
@ -670,7 +670,7 @@ static int read_redo(bool init, bool old_redo)
|
||||
}
|
||||
if (*++p == NUL && bp->b_next != NULL) {
|
||||
bp = bp->b_next;
|
||||
p = bp->b_str;
|
||||
p = (char_u *)bp->b_str;
|
||||
}
|
||||
buf[i] = (char_u)c;
|
||||
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++) {
|
||||
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
|
||||
@ -2047,12 +2047,11 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
|
||||
// - Partly match: mlen == typebuf.tb_len
|
||||
keylen = mp->m_keylen;
|
||||
if (mlen == keylen || (mlen == typebuf.tb_len && typebuf.tb_len < keylen)) {
|
||||
char_u *s;
|
||||
int n;
|
||||
|
||||
// If only script-local mappings are allowed, check if the
|
||||
// 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
|
||||
&& (mp->m_keys[0] != K_SPECIAL
|
||||
|| 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);
|
||||
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);
|
||||
|
||||
@ -2280,7 +2279,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
|
||||
vgetc_busy = save_vgetc_busy;
|
||||
may_garbage_collect = save_may_garbage_collect;
|
||||
} else {
|
||||
map_str = mp->m_str;
|
||||
map_str = (char_u *)mp->m_str;
|
||||
}
|
||||
|
||||
// Insert the 'to' part in the typebuf.tb_buf.
|
||||
@ -2501,7 +2500,7 @@ static int vgetorpeek(bool advance)
|
||||
// write char to script file(s)
|
||||
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);
|
||||
}
|
||||
break; // got character, break the for loop
|
||||
|
@ -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
|
||||
// situations), it is set to empty_option, to avoid having to check for NULL
|
||||
// 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 FILE *redir_fd INIT(= NULL); // message redirection file
|
||||
|
@ -710,7 +710,7 @@ int get_number_indent(linenr_T lnum)
|
||||
if ((State & MODE_INSERT) || has_format_option(FO_Q_COMS)) {
|
||||
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) {
|
||||
regmatch.rm_ic = false;
|
||||
@ -770,7 +770,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
|
||||
// add additional indent for numbered lists
|
||||
if (wp->w_briopt_list != 0) {
|
||||
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),
|
||||
};
|
||||
|
||||
@ -855,7 +855,7 @@ int get_expr_indent(void)
|
||||
|
||||
// Need to make a copy, the 'indentexpr' option could be changed while
|
||||
// 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);
|
||||
xfree(inde_copy);
|
||||
|
||||
@ -1077,7 +1077,7 @@ static int lisp_match(char_u *p)
|
||||
{
|
||||
char_u buf[LSIZE];
|
||||
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) {
|
||||
(void)copy_option_part(&word, (char *)buf, LSIZE, ",");
|
||||
|
@ -223,7 +223,7 @@ bool cin_is_cinword(const char_u *line)
|
||||
char_u *cinw_buf = xmalloc(cinw_len);
|
||||
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, ",");
|
||||
if (STRNCMP(line, cinw_buf, len) == 0
|
||||
&& (!vim_iswordc(line[len]) || !vim_iswordc(line[len - 1]))) {
|
||||
@ -519,7 +519,7 @@ bool cin_isscopedecl(const char_u *p)
|
||||
|
||||
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, ",");
|
||||
if (STRNCMP(s, cinsd_buf, len) == 0) {
|
||||
const char_u *skip = cin_skipcomment(s + len);
|
||||
@ -1740,7 +1740,7 @@ void parse_cino(buf_T *buf)
|
||||
// Handle C #pragma directives
|
||||
buf->b_ind_pragma = 0;
|
||||
|
||||
for (p = (char *)buf->b_p_cino; *p;) {
|
||||
for (p = buf->b_p_cino; *p;) {
|
||||
l = p++;
|
||||
if (*p == '-') {
|
||||
p++;
|
||||
@ -2063,7 +2063,7 @@ int get_c_indent(void)
|
||||
*lead_start = NUL;
|
||||
*lead_middle = NUL;
|
||||
|
||||
p = (char *)curbuf->b_p_com;
|
||||
p = curbuf->b_p_com;
|
||||
while (*p != NUL) {
|
||||
int align = 0;
|
||||
int off = 0;
|
||||
|
@ -901,7 +901,7 @@ static void ins_compl_longest_match(compl_T *match)
|
||||
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + get_compl_len());
|
||||
ins_bytes((char *)compl_leader + get_compl_len());
|
||||
ins_redraw(false);
|
||||
|
||||
// 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;
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + get_compl_len());
|
||||
ins_bytes((char *)compl_leader + get_compl_len());
|
||||
ins_redraw(false);
|
||||
|
||||
// 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_delete();
|
||||
ins_bytes(compl_leader + get_compl_len());
|
||||
ins_bytes((char *)compl_leader + get_compl_len());
|
||||
compl_used_match = false;
|
||||
|
||||
if (compl_started) {
|
||||
@ -2224,11 +2224,11 @@ static char_u *get_complete_funcname(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case CTRL_X_FUNCTION:
|
||||
return curbuf->b_p_cfu;
|
||||
return (char_u *)curbuf->b_p_cfu;
|
||||
case CTRL_X_OMNI:
|
||||
return curbuf->b_p_ofu;
|
||||
return (char_u *)curbuf->b_p_ofu;
|
||||
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:
|
||||
return (char_u *)"";
|
||||
}
|
||||
@ -2823,8 +2823,8 @@ static void get_next_dict_tsr_completion(int compl_type, char_u *dict, int dict_
|
||||
} else {
|
||||
ins_compl_dictionaries(dict != NULL ? dict
|
||||
: (compl_type == CTRL_X_THESAURUS
|
||||
? (*curbuf->b_p_tsr == NUL ? p_tsr : curbuf->b_p_tsr)
|
||||
: (*curbuf->b_p_dict == NUL ? p_dict : curbuf->b_p_dict)),
|
||||
? (*curbuf->b_p_tsr == NUL ? p_tsr : (char_u *)curbuf->b_p_tsr)
|
||||
: (*curbuf->b_p_dict == NUL ? p_dict : (char_u *)curbuf->b_p_dict)),
|
||||
(char_u *)compl_pattern,
|
||||
dict != NULL ? dict_f : 0,
|
||||
compl_type == CTRL_X_THESAURUS);
|
||||
@ -3174,7 +3174,7 @@ static int ins_compl_get_exp(pos_T *ini)
|
||||
}
|
||||
st.found_all = false;
|
||||
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;
|
||||
} else if (st.ins_buf != curbuf && !buf_valid(st.ins_buf)) {
|
||||
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().
|
||||
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);
|
||||
|
||||
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.
|
||||
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;
|
||||
} else if (insert_match) {
|
||||
if (!compl_get_longest || compl_used_match) {
|
||||
ins_compl_insert(in_compl_func);
|
||||
} else {
|
||||
ins_bytes(compl_leader + get_compl_len());
|
||||
ins_bytes((char *)compl_leader + get_compl_len());
|
||||
}
|
||||
} else {
|
||||
compl_used_match = false;
|
||||
@ -4079,9 +4079,9 @@ static int ins_compl_start(void)
|
||||
edit_submode_pre = (char_u *)_(" Adding");
|
||||
if (ctrl_x_mode_line_or_eval()) {
|
||||
// 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.col = compl_col;
|
||||
ins_eol('\r');
|
||||
|
@ -990,7 +990,7 @@ int nlua_in_fast_event(lua_State *lstate)
|
||||
|
||||
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) {
|
||||
return fdef->fast;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ static void showmap(mapblock_T *mp, bool local)
|
||||
{
|
||||
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))) {
|
||||
return;
|
||||
}
|
||||
@ -203,7 +203,7 @@ static void showmap(mapblock_T *mp, bool local)
|
||||
} else if (mp->m_str[0] == NUL) {
|
||||
msg_puts_attr("<Nop>", HL_ATTR(HLF_8));
|
||||
} else {
|
||||
msg_outtrans_special(mp->m_str, false, 0);
|
||||
msg_outtrans_special((char_u *)mp->m_str, false, 0);
|
||||
}
|
||||
|
||||
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_str = args->rhs;
|
||||
mp->m_orig_str = args->orig_rhs;
|
||||
mp->m_str = (char *)args->rhs;
|
||||
mp->m_orig_str = (char *)args->orig_rhs;
|
||||
mp->m_luaref = args->rhs_lua;
|
||||
if (!simplified) {
|
||||
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?
|
||||
if (round) { // second round: Try unmap "rhs" string
|
||||
n = (int)STRLEN(mp->m_str);
|
||||
p = mp->m_str;
|
||||
p = (char_u *)mp->m_str;
|
||||
} else {
|
||||
n = mp->m_keylen;
|
||||
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_orig_str);
|
||||
}
|
||||
mp->m_str = args->rhs;
|
||||
mp->m_orig_str = args->orig_rhs;
|
||||
mp->m_str = (char *)args->rhs;
|
||||
mp->m_orig_str = (char *)args->orig_rhs;
|
||||
mp->m_luaref = args->rhs_lua;
|
||||
if (!keyround1_simplified) {
|
||||
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];
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1506,7 +1506,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
|
||||
if (mp->m_expr) {
|
||||
s = eval_map_expr(mp, c);
|
||||
} else {
|
||||
s = mp->m_str;
|
||||
s = (char_u *)mp->m_str;
|
||||
}
|
||||
if (s != NULL) {
|
||||
// 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
|
||||
// typeahead.
|
||||
if (mp->m_luaref == LUA_NOREF) {
|
||||
expr = vim_strsave(mp->m_str);
|
||||
expr = vim_strsave((char_u *)mp->m_str);
|
||||
vim_unescape_ks(expr);
|
||||
}
|
||||
|
||||
@ -1639,7 +1639,7 @@ int makemap(FILE *fd, buf_T *buf)
|
||||
if (mp->m_luaref != LUA_NOREF) {
|
||||
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
|
||||
&& p[2] == KE_SNR) {
|
||||
break;
|
||||
@ -1785,7 +1785,7 @@ int makemap(FILE *fd, buf_T *buf)
|
||||
if (putc(' ', fd) < 0
|
||||
|| put_escstr(fd, mp->m_keys, 0) == FAIL
|
||||
|| 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) {
|
||||
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;
|
||||
}
|
||||
*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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1932,11 +1932,11 @@ void utf_find_illegal(void)
|
||||
char_u *tofree = NULL;
|
||||
|
||||
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,
|
||||
// possibly a utf-8 file with illegal bytes. Setup for conversion
|
||||
// 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;
|
||||
|
@ -721,7 +721,7 @@ static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf)
|
||||
b0p->b0_flags &= (uint8_t) ~B0_HAS_FENC;
|
||||
} else {
|
||||
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_flags |= B0_HAS_FENC;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ bool server_stop(char *endpoint)
|
||||
watchers.ga_len--;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -2653,10 +2653,10 @@ void clear_showcmd(void)
|
||||
|
||||
if (VIsual_mode == Ctrl_V) {
|
||||
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.
|
||||
p_sbr = empty_option;
|
||||
p_sbr = (char_u *)empty_option;
|
||||
curwin->w_p_sbr = empty_option;
|
||||
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
|
||||
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
|
||||
// double the length of the word. p_kp / curbuf->b_p_kp could be added
|
||||
// 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.
|
||||
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
|
||||
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
|
||||
}
|
||||
// Make sure (), [], {} and <> are in 'matchpairs'
|
||||
mps_save = curbuf->b_p_mps;
|
||||
curbuf->b_p_mps = (char_u *)"(:),{:},[:],<:>";
|
||||
mps_save = (char_u *)curbuf->b_p_mps;
|
||||
curbuf->b_p_mps = "(:),{:},[:],<:>";
|
||||
|
||||
switch (cap->nchar) {
|
||||
case 'w': // "aw" = a word
|
||||
@ -7130,7 +7130,7 @@ static void nv_object(cmdarg_T *cap)
|
||||
break;
|
||||
}
|
||||
|
||||
curbuf->b_p_mps = mps_save;
|
||||
curbuf->b_p_mps = (char *)mps_save;
|
||||
if (!flag) {
|
||||
clearopbeep(cap->oap);
|
||||
}
|
||||
|
@ -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 r;
|
||||
char_u *fex;
|
||||
|
||||
/*
|
||||
* 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: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_vim_var_nr(VV_LNUM, (varnumber_T)lnum);
|
||||
set_vim_var_nr(VV_COUNT, (varnumber_T)count);
|
||||
set_vim_var_char(c);
|
||||
|
||||
// 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.
|
||||
if (use_sandbox) {
|
||||
sandbox++;
|
||||
}
|
||||
r = (int)eval_to_number((char *)fex);
|
||||
r = (int)eval_to_number(fex);
|
||||
if (use_sandbox) {
|
||||
sandbox--;
|
||||
}
|
||||
@ -5008,12 +5005,12 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
||||
pos_T endpos;
|
||||
colnr_T save_coladd = 0;
|
||||
|
||||
const bool do_hex = vim_strchr((char *)curbuf->b_p_nf, 'x') != NULL; // "heX"
|
||||
const bool do_oct = vim_strchr((char *)curbuf->b_p_nf, 'o') != NULL; // "Octal"
|
||||
const bool do_bin = vim_strchr((char *)curbuf->b_p_nf, 'b') != NULL; // "Bin"
|
||||
const bool do_alpha = vim_strchr((char *)curbuf->b_p_nf, 'p') != NULL; // "alPha"
|
||||
const bool do_hex = vim_strchr(curbuf->b_p_nf, 'x') != NULL; // "heX"
|
||||
const bool do_oct = vim_strchr(curbuf->b_p_nf, 'o') != NULL; // "Octal"
|
||||
const bool do_bin = vim_strchr(curbuf->b_p_nf, 'b') != NULL; // "Bin"
|
||||
const bool do_alpha = vim_strchr(curbuf->b_p_nf, 'p') != NULL; // "alPha"
|
||||
// "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()) {
|
||||
save_coladd = pos->coladd;
|
||||
@ -5886,10 +5883,10 @@ void cursor_pos_info(dict_T *dict)
|
||||
|
||||
if (l_VIsual_mode == Ctrl_V) {
|
||||
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.
|
||||
p_sbr = empty_option;
|
||||
p_sbr = (char_u *)empty_option;
|
||||
curwin->w_p_sbr = empty_option;
|
||||
oparg.is_VIsual = true;
|
||||
oparg.motion_type = kMTBlockWise;
|
||||
|
@ -464,7 +464,7 @@ static void set_option_default(int opt_idx, int opt_flags)
|
||||
(char *)options[opt_idx].def_val, opt_flags, 0);
|
||||
} else {
|
||||
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;
|
||||
options[opt_idx].flags &= ~P_ALLOCED;
|
||||
@ -603,14 +603,14 @@ void free_all_options(void)
|
||||
if (options[i].indir == PV_NONE) {
|
||||
// global option: free value and default value.
|
||||
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) {
|
||||
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)) {
|
||||
// buffer-local option: free global value
|
||||
clear_string_option((char_u **)options[i].var);
|
||||
clear_string_option((char **)options[i].var);
|
||||
}
|
||||
}
|
||||
free_operatorfunc_option();
|
||||
@ -730,7 +730,7 @@ void set_helplang_default(const char *lang)
|
||||
int idx = findoption("hlg");
|
||||
if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) {
|
||||
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);
|
||||
// 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
|
||||
// option as value to indicate that the global
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -1205,7 +1205,7 @@ int do_set(char *arg, int opt_flags)
|
||||
// required when an environment variable was set
|
||||
// later
|
||||
if (newval == NULL) {
|
||||
newval = empty_option;
|
||||
newval = (char_u *)empty_option;
|
||||
} else if (!(options[opt_idx].flags & P_NO_DEF_EXP)) {
|
||||
s = option_expand(opt_idx, newval);
|
||||
if (s == NULL) {
|
||||
@ -1233,7 +1233,7 @@ int do_set(char *arg, int opt_flags)
|
||||
i = getdigits_int((char **)varp, true, 0);
|
||||
switch (i) {
|
||||
case 0:
|
||||
*(char_u **)varp = empty_option;
|
||||
*(char **)varp = empty_option;
|
||||
break;
|
||||
case 1:
|
||||
*(char_u **)varp = vim_strsave((char_u *)"indent,eol");
|
||||
@ -1797,17 +1797,17 @@ static void didset_options2(void)
|
||||
highlight_changed();
|
||||
|
||||
// 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'.
|
||||
(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'.
|
||||
check_opt_wim();
|
||||
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);
|
||||
(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).
|
||||
@ -1817,7 +1817,7 @@ void check_options(void)
|
||||
|
||||
for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) {
|
||||
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".
|
||||
int makefoldset(FILE *fd)
|
||||
{
|
||||
if (put_setstring(fd, "setlocal", "fdm", &curwin->w_p_fdm, 0) == FAIL
|
||||
|| put_setstring(fd, "setlocal", "fde", &curwin->w_p_fde, 0)
|
||||
if (put_setstring(fd, "setlocal", "fdm", (char_u **)&curwin->w_p_fdm, 0) == FAIL
|
||||
|| put_setstring(fd, "setlocal", "fde", (char_u **)&curwin->w_p_fde, 0)
|
||||
== FAIL
|
||||
|| put_setstring(fd, "setlocal", "fmr", &curwin->w_p_fmr, 0)
|
||||
|| put_setstring(fd, "setlocal", "fmr", (char_u **)&curwin->w_p_fmr, 0)
|
||||
== FAIL
|
||||
|| put_setstring(fd, "setlocal", "fdi", &curwin->w_p_fdi, 0)
|
||||
|| put_setstring(fd, "setlocal", "fdi", (char_u **)&curwin->w_p_fdi, 0)
|
||||
== FAIL
|
||||
|| put_setnum(fd, "setlocal", "fdl", &curwin->w_p_fdl) == 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);
|
||||
break;
|
||||
case PV_WBR:
|
||||
clear_string_option((char_u **)&((win_T *)from)->w_p_wbr);
|
||||
clear_string_option(&((win_T *)from)->w_p_wbr);
|
||||
break;
|
||||
case PV_UL:
|
||||
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
|
||||
@ -3816,12 +3816,12 @@ void unset_global_local_option(char *name, void *from)
|
||||
break;
|
||||
case PV_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);
|
||||
break;
|
||||
case PV_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);
|
||||
break;
|
||||
case PV_VE:
|
||||
@ -4238,7 +4238,7 @@ char_u *get_equalprg(void)
|
||||
if (*curbuf->b_p_ep == NUL) {
|
||||
return p_ep;
|
||||
}
|
||||
return curbuf->b_p_ep;
|
||||
return (char_u *)curbuf->b_p_ep;
|
||||
}
|
||||
|
||||
/// 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_nu = from->wo_nu;
|
||||
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_nuw = from->wo_nuw;
|
||||
to->wo_rl = from->wo_rl;
|
||||
to->wo_rlc = vim_strsave(from->wo_rlc);
|
||||
to->wo_sbr = vim_strsave(from->wo_sbr);
|
||||
to->wo_stl = vim_strsave(from->wo_stl);
|
||||
to->wo_rlc = xstrdup(from->wo_rlc);
|
||||
to->wo_sbr = xstrdup(from->wo_sbr);
|
||||
to->wo_stl = xstrdup(from->wo_stl);
|
||||
to->wo_wbr = xstrdup(from->wo_wbr);
|
||||
to->wo_wrap = from->wo_wrap;
|
||||
to->wo_wrap_save = from->wo_wrap_save;
|
||||
to->wo_lbr = from->wo_lbr;
|
||||
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_save = from->wo_scb_save;
|
||||
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_cuc = from->wo_cuc;
|
||||
to->wo_cul = from->wo_cul;
|
||||
to->wo_culopt = vim_strsave(from->wo_culopt);
|
||||
to->wo_cc = vim_strsave(from->wo_cc);
|
||||
to->wo_culopt = xstrdup(from->wo_culopt);
|
||||
to->wo_cc = xstrdup(from->wo_cc);
|
||||
to->wo_diff = from->wo_diff;
|
||||
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_fdc = vim_strsave(from->wo_fdc);
|
||||
to->wo_fdc_save = from->wo_diff_saved
|
||||
? vim_strsave(from->wo_fdc_save) : empty_option;
|
||||
to->wo_fdc = xstrdup(from->wo_fdc);
|
||||
to->wo_fdc_save = from->wo_diff_saved ? xstrdup(from->wo_fdc_save) : empty_option;
|
||||
to->wo_fen = from->wo_fen;
|
||||
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_fdl = from->wo_fdl;
|
||||
to->wo_fdl_save = from->wo_fdl_save;
|
||||
to->wo_fdm = vim_strsave(from->wo_fdm);
|
||||
to->wo_fdm_save = from->wo_diff_saved
|
||||
? vim_strsave(from->wo_fdm_save) : empty_option;
|
||||
to->wo_fdm = xstrdup(from->wo_fdm);
|
||||
to->wo_fdm_save = from->wo_diff_saved ? xstrdup(from->wo_fdm_save) : empty_option;
|
||||
to->wo_fdn = from->wo_fdn;
|
||||
to->wo_fde = vim_strsave(from->wo_fde);
|
||||
to->wo_fdt = vim_strsave(from->wo_fdt);
|
||||
to->wo_fmr = vim_strsave(from->wo_fmr);
|
||||
to->wo_scl = vim_strsave(from->wo_scl);
|
||||
to->wo_winhl = vim_strsave(from->wo_winhl);
|
||||
to->wo_fcs = vim_strsave(from->wo_fcs);
|
||||
to->wo_lcs = vim_strsave(from->wo_lcs);
|
||||
to->wo_fde = xstrdup(from->wo_fde);
|
||||
to->wo_fdt = xstrdup(from->wo_fdt);
|
||||
to->wo_fmr = xstrdup(from->wo_fmr);
|
||||
to->wo_scl = xstrdup(from->wo_scl);
|
||||
to->wo_winhl = xstrdup(from->wo_winhl);
|
||||
to->wo_fcs = xstrdup(from->wo_fcs);
|
||||
to->wo_lcs = xstrdup(from->wo_lcs);
|
||||
to->wo_winbl = from->wo_winbl;
|
||||
|
||||
// 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_lcs);
|
||||
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.
|
||||
@ -4369,7 +4367,7 @@ void clear_winopt(winopt_T *wop)
|
||||
clear_string_option(&wop->wo_fcs);
|
||||
clear_string_option(&wop->wo_lcs);
|
||||
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)
|
||||
@ -4377,8 +4375,8 @@ void didset_window_options(win_T *wp, bool valid_cursor)
|
||||
check_colorcolumn(wp);
|
||||
briopt_check(wp);
|
||||
fill_culopt_flags(NULL, wp);
|
||||
set_chars_option(wp, &wp->w_p_fcs, true);
|
||||
set_chars_option(wp, &wp->w_p_lcs, true);
|
||||
set_chars_option(wp, (char_u **)&wp->w_p_fcs, 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
|
||||
check_blending(wp);
|
||||
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)
|
||||
dont_do_help = ((flags & BCO_NOHELP) && buf->b_help) || buf->b_p_initialized;
|
||||
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;
|
||||
}
|
||||
// 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) {
|
||||
free_buf_options(buf, true);
|
||||
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) {
|
||||
case 'm':
|
||||
buf->b_p_ff = vim_strsave((char_u *)FF_MAC);
|
||||
buf->b_p_ff = xstrdup(FF_MAC);
|
||||
break;
|
||||
case 'd':
|
||||
buf->b_p_ff = vim_strsave((char_u *)FF_DOS);
|
||||
buf->b_p_ff = xstrdup(FF_DOS);
|
||||
break;
|
||||
case 'u':
|
||||
buf->b_p_ff = vim_strsave((char_u *)FF_UNIX);
|
||||
buf->b_p_ff = xstrdup(FF_UNIX);
|
||||
break;
|
||||
default:
|
||||
buf->b_p_ff = vim_strsave(p_ff);
|
||||
buf->b_p_ff = (char *)vim_strsave(p_ff);
|
||||
break;
|
||||
}
|
||||
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;
|
||||
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);
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
buf->b_p_csl = vim_strsave(p_csl);
|
||||
COPY_OPT_SCTX(buf, BV_CSL);
|
||||
#endif
|
||||
buf->b_p_cfu = vim_strsave(p_cfu);
|
||||
buf->b_p_cfu = (char *)vim_strsave(p_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);
|
||||
buf->b_p_tfu = vim_strsave(p_tfu);
|
||||
buf->b_p_tfu = (char *)vim_strsave(p_tfu);
|
||||
COPY_OPT_SCTX(buf, BV_TFU);
|
||||
buf->b_p_sts = p_sts;
|
||||
COPY_OPT_SCTX(buf, BV_STS);
|
||||
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);
|
||||
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);
|
||||
} else {
|
||||
buf->b_p_vsts_array = NULL;
|
||||
}
|
||||
buf->b_p_vsts_nopaste = p_vsts_nopaste
|
||||
? vim_strsave(p_vsts_nopaste)
|
||||
? (char *)vim_strsave(p_vsts_nopaste)
|
||||
: NULL;
|
||||
buf->b_p_com = vim_strsave(p_com);
|
||||
buf->b_p_com = (char *)vim_strsave(p_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);
|
||||
buf->b_p_fo = vim_strsave(p_fo);
|
||||
buf->b_p_fo = (char *)vim_strsave(p_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);
|
||||
buf->b_p_nf = vim_strsave(p_nf);
|
||||
buf->b_p_nf = (char *)vim_strsave(p_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);
|
||||
buf->b_p_si = p_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);
|
||||
buf->b_p_cin = p_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);
|
||||
buf->b_p_cino = vim_strsave(p_cino);
|
||||
buf->b_p_cino = (char *)vim_strsave(p_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);
|
||||
|
||||
// Don't copy 'filetype', it must be detected
|
||||
buf->b_p_ft = empty_option;
|
||||
buf->b_p_pi = p_pi;
|
||||
COPY_OPT_SCTX(buf, BV_PI);
|
||||
buf->b_p_cinw = vim_strsave(p_cinw);
|
||||
buf->b_p_cinw = (char *)vim_strsave(p_cinw);
|
||||
COPY_OPT_SCTX(buf, BV_CINW);
|
||||
buf->b_p_lisp = p_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;
|
||||
COPY_OPT_SCTX(buf, BV_SMC);
|
||||
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);
|
||||
(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);
|
||||
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);
|
||||
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);
|
||||
buf->b_p_inde = vim_strsave(p_inde);
|
||||
buf->b_p_inde = (char *)vim_strsave(p_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);
|
||||
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);
|
||||
buf->b_p_sua = vim_strsave(p_sua);
|
||||
buf->b_p_sua = (char *)vim_strsave(p_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);
|
||||
buf->b_kmap_state |= KEYMAP_INIT;
|
||||
// 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_p_def = 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);
|
||||
buf->b_p_dict = empty_option;
|
||||
buf->b_p_tsr = 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);
|
||||
buf->b_p_udf = p_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.
|
||||
*/
|
||||
if (dont_do_help) {
|
||||
buf->b_p_isk = save_p_isk;
|
||||
if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) {
|
||||
buf->b_p_isk = (char *)save_p_isk;
|
||||
if (p_vts && p_vts != (char_u *)empty_option && !buf->b_p_vts_array) {
|
||||
(void)tabstop_set(p_vts, &buf->b_p_vts_array);
|
||||
} else {
|
||||
buf->b_p_vts_array = NULL;
|
||||
}
|
||||
} else {
|
||||
buf->b_p_isk = vim_strsave(p_isk);
|
||||
buf->b_p_isk = (char *)vim_strsave(p_isk);
|
||||
COPY_OPT_SCTX(buf, BV_ISK);
|
||||
did_isk = true;
|
||||
buf->b_p_ts = p_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);
|
||||
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);
|
||||
} else {
|
||||
buf->b_p_vts_array = NULL;
|
||||
@ -5065,7 +5063,7 @@ bool has_format_option(int x)
|
||||
if (p_paste) {
|
||||
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
|
||||
@ -5105,7 +5103,7 @@ static void paste_option_changed(void)
|
||||
xfree(buf->b_p_vsts_nopaste);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@ -5124,7 +5122,7 @@ static void paste_option_changed(void)
|
||||
if (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)
|
||||
: NULL;
|
||||
}
|
||||
@ -5160,9 +5158,9 @@ static void paste_option_changed(void)
|
||||
p_sts = 0;
|
||||
p_ai = 0;
|
||||
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) {
|
||||
// Paste switched from on to off: Restore saved values.
|
||||
|
||||
@ -5176,12 +5174,10 @@ static void paste_option_changed(void)
|
||||
if (buf->b_p_vsts) {
|
||||
free_string_option(buf->b_p_vsts);
|
||||
}
|
||||
buf->b_p_vsts = buf->b_p_vsts_nopaste
|
||||
? vim_strsave(buf->b_p_vsts_nopaste)
|
||||
: empty_option;
|
||||
buf->b_p_vsts = buf->b_p_vsts_nopaste ? xstrdup(buf->b_p_vsts_nopaste) : empty_option;
|
||||
xfree(buf->b_p_vsts_array);
|
||||
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 {
|
||||
buf->b_p_vsts_array = NULL;
|
||||
}
|
||||
@ -5203,9 +5199,9 @@ static void paste_option_changed(void)
|
||||
p_tw = p_tw_nopaste;
|
||||
p_wm = p_wm_nopaste;
|
||||
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;
|
||||
@ -5286,7 +5282,7 @@ int fill_culopt_flags(char_u *val, win_T *wp)
|
||||
char_u culopt_flags_new = 0;
|
||||
|
||||
if (val == NULL) {
|
||||
p = wp->w_p_culopt;
|
||||
p = (char_u *)wp->w_p_culopt;
|
||||
} else {
|
||||
p = val;
|
||||
}
|
||||
@ -5437,7 +5433,7 @@ bool can_bs(int what)
|
||||
/// the file must be considered changed when the value is different.
|
||||
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_bomb = buf->b_p_bomb;
|
||||
|
||||
@ -5445,7 +5441,7 @@ void save_file_ff(buf_T *buf)
|
||||
if (buf->b_start_fenc == NULL
|
||||
|| STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) {
|
||||
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;
|
||||
int bri_list = 0;
|
||||
|
||||
char *p = (char *)wp->w_p_briopt;
|
||||
char *p = wp->w_p_briopt;
|
||||
while (*p != NUL) {
|
||||
if (STRNCMP(p, "shift:", 6) == 0
|
||||
&& ((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;
|
||||
}
|
||||
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.
|
||||
int get_fileformat(const buf_T *buf)
|
||||
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') {
|
||||
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) {
|
||||
return EOL_UNIX;
|
||||
}
|
||||
c = *buf->b_p_ff;
|
||||
c = (unsigned char)(*buf->b_p_ff);
|
||||
}
|
||||
if (c == 'u') {
|
||||
return EOL_UNIX;
|
||||
|
@ -254,14 +254,14 @@ void check_buf_options(buf_T *buf)
|
||||
/// memory, vim_strsave() returned NULL, which was replaced by empty_option by
|
||||
/// check_options().
|
||||
/// Does NOT check for P_ALLOCED flag!
|
||||
void free_string_option(char_u *p)
|
||||
void free_string_option(char *p)
|
||||
{
|
||||
if (p != empty_option) {
|
||||
xfree(p);
|
||||
}
|
||||
}
|
||||
|
||||
void clear_string_option(char_u **pp)
|
||||
void clear_string_option(char **pp)
|
||||
{
|
||||
if (*pp != empty_option) {
|
||||
xfree(*pp);
|
||||
@ -269,7 +269,7 @@ void clear_string_option(char_u **pp)
|
||||
*pp = empty_option;
|
||||
}
|
||||
|
||||
void check_string_option(char_u **pp)
|
||||
void check_string_option(char **pp)
|
||||
{
|
||||
if (*pp == NULL) {
|
||||
*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) {
|
||||
s = vim_strsave(*varp);
|
||||
free_string_option(*p);
|
||||
free_string_option((char *)(*p));
|
||||
*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);
|
||||
if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED)) {
|
||||
free_string_option((char_u *)(*varp));
|
||||
free_string_option(*varp);
|
||||
}
|
||||
*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,
|
||||
// make the local value empty, so that the global value is used.
|
||||
if (is_global_local_option(idx) && both) {
|
||||
free_string_option((char_u *)(*varp));
|
||||
*varp = (char *)empty_option;
|
||||
free_string_option(*varp);
|
||||
*varp = empty_option;
|
||||
}
|
||||
if (set_sid != SID_NONE) {
|
||||
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;
|
||||
|
||||
if (opt_flags & OPT_LOCAL) {
|
||||
bkc = curbuf->b_p_bkc;
|
||||
bkc = (char_u *)curbuf->b_p_bkc;
|
||||
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) {
|
||||
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) {
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
} else if (varp == &p_isi
|
||||
|| varp == &(curbuf->b_p_isk)
|
||||
|| varp == (char_u **)&(curbuf->b_p_isk)
|
||||
|| varp == &p_isp
|
||||
|| varp == &p_isf) {
|
||||
// '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'
|
||||
runtime_search_path_invalidate();
|
||||
} else if (varp == &curwin->w_p_culopt
|
||||
|| gvarp == &curwin->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
|
||||
} else if (varp == (char_u **)&curwin->w_p_culopt
|
||||
|| gvarp == (char_u **)&curwin->w_allbuf_opt.wo_culopt) { // 'cursorlineopt'
|
||||
if (**varp == NUL || fill_culopt_flags(*varp, curwin) != OK) {
|
||||
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);
|
||||
} else if (varp == &p_hlg) { // 'helplang'
|
||||
// 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
|
||||
// scheme and set the colors again.
|
||||
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"));
|
||||
check_string_option(&p_bg);
|
||||
check_string_option((char **)&p_bg);
|
||||
init_highlight(false, false);
|
||||
}
|
||||
} 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);
|
||||
xfree(p_penc);
|
||||
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)) {
|
||||
errmsg = e_invarg;
|
||||
} 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) {
|
||||
// If no error was returned above, we don't expect an error
|
||||
// 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);
|
||||
}
|
||||
} 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);
|
||||
} else if (varp == &p_fcs) { // global 'fillchars'
|
||||
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) {
|
||||
// If no error was returned above, we don't expect an error
|
||||
// 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);
|
||||
}
|
||||
} 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);
|
||||
} else if (varp == &p_cedit) { // '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) {
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
} else if (varp == &(curwin->w_s->b_p_spl) // 'spell'
|
||||
|| varp == &(curwin->w_s->b_p_spf)) {
|
||||
} else if (varp == (char_u **)&(curwin->w_s->b_p_spl) // 'spell'
|
||||
|| varp == (char_u **)&(curwin->w_s->b_p_spf)) {
|
||||
// When 'spelllang' or 'spellfile' is set and there is a window for this
|
||||
// buffer in which 'spell' is set load the wordlists.
|
||||
const bool is_spellfile = varp == &(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))
|
||||
|| (!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 {
|
||||
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.
|
||||
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) {
|
||||
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) {
|
||||
// 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;
|
||||
}
|
||||
} else if (gvarp == &p_bt) {
|
||||
// When 'buftype' is set, check for valid value.
|
||||
if ((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;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
} else if (varp == &curwin->w_p_scl) { // 'signcolumn'
|
||||
} else if (varp == (char_u **)&curwin->w_p_scl) { // 'signcolumn'
|
||||
if (check_signcolumn(*varp) != OK) {
|
||||
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_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'
|
||||
if (**varp == NUL || check_opt_strings(*varp, p_fdc_values, false) != OK) {
|
||||
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,
|
||||
CPO_TO_CPO_FLAGS);
|
||||
if (p != NULL) {
|
||||
free_string_option(p_pt);
|
||||
free_string_option((char *)p_pt);
|
||||
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;
|
||||
|
||||
if (opt_flags & OPT_LOCAL) {
|
||||
p = (char *)curbuf->b_p_tc;
|
||||
p = curbuf->b_p_tc;
|
||||
flags = &curbuf->b_tc_flags;
|
||||
} else {
|
||||
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) {
|
||||
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
|
||||
|| *curwin->w_p_fdm == NUL) {
|
||||
errmsg = e_invarg;
|
||||
@ -1318,11 +1319,11 @@ char *did_set_string_option(int opt_idx, char_u **varp, char_u *oldval, char *er
|
||||
newFoldLevel();
|
||||
}
|
||||
}
|
||||
} else if (varp == &curwin->w_p_fde) { // 'foldexpr'
|
||||
} else if (varp == (char_u **)&curwin->w_p_fde) { // 'foldexpr'
|
||||
if (foldmethodIsExpr(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), ',');
|
||||
if (p == NULL) {
|
||||
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) {
|
||||
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)) {
|
||||
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;
|
||||
|
||||
if (opt_flags & OPT_LOCAL) {
|
||||
ve = curwin->w_p_ve;
|
||||
ve = (char_u *)curwin->w_p_ve;
|
||||
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.
|
||||
*value_checked = true;
|
||||
}
|
||||
} else if (varp == &curwin->w_p_winhl) {
|
||||
} else if (varp == (char_u **)&curwin->w_p_winhl) {
|
||||
if (!parse_winhl_opt(curwin)) {
|
||||
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) {
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
} else if (varp == &(curbuf->b_p_vsts)) { // 'varsofttabstop'
|
||||
} else if (varp == (char_u **)&(curbuf->b_p_vsts)) { // 'varsofttabstop'
|
||||
char_u *cp;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
} else if (varp == (char_u **)&(p_cpo)) { // 'cpoptions'
|
||||
p = CPO_VI;
|
||||
} else if (varp == &(curbuf->b_p_fo)) { // 'formatoptions'
|
||||
} else if (varp == (char_u **)&(curbuf->b_p_fo)) { // 'formatoptions'
|
||||
p = FO_ALL;
|
||||
} else if (varp == &curwin->w_p_cocu) { // 'concealcursor'
|
||||
} else if (varp == (char_u **)&curwin->w_p_cocu) { // 'concealcursor'
|
||||
p = COCU_ALL;
|
||||
} else if (varp == &p_mouse) { // 'mouse'
|
||||
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 (errmsg != NULL) {
|
||||
free_string_option(*varp);
|
||||
free_string_option((char *)(*varp));
|
||||
*varp = oldval;
|
||||
// When resetting some values, need to act on it.
|
||||
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
|
||||
// our fingers (esp. init_highlight()).
|
||||
if (free_oldval) {
|
||||
free_string_option(oldval);
|
||||
free_string_option((char *)oldval);
|
||||
}
|
||||
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
|
||||
// the local value and make it empty
|
||||
p = (char *)get_option_varp_scope(opt_idx, OPT_LOCAL);
|
||||
free_string_option(*(char_u **)p);
|
||||
*(char_u **)p = empty_option;
|
||||
free_string_option(*(char **)p);
|
||||
*(char **)p = empty_option;
|
||||
} else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) {
|
||||
// May set global value for local option.
|
||||
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.
|
||||
// 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;
|
||||
|
||||
syn_recursive++;
|
||||
// Only pass true for "force" when the value changed or not used
|
||||
// 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);
|
||||
curbuf->b_flags |= BF_SYN_SET;
|
||||
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
|
||||
// Skip this when called from a modeline and the filetype was
|
||||
// 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;
|
||||
// Only pass true for "force" when the value changed or not
|
||||
// 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);
|
||||
ft_recursive--;
|
||||
// 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;
|
||||
}
|
||||
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 *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".
|
||||
if (STRNCMP(q, "cjk,", 4) == 0) {
|
||||
|
@ -74,7 +74,7 @@ static bool have_wildcard(int num, char **file)
|
||||
static bool have_dollars(int num, char **file)
|
||||
{
|
||||
for (int i = 0; i < num; i++) {
|
||||
if (vim_strchr((char *)file[i], '$') != NULL) {
|
||||
if (vim_strchr(file[i], '$') != NULL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -376,16 +376,16 @@ int path_fnamencmp(const char *const fname1, const char *const fname2, size_t le
|
||||
const char *p1 = fname1;
|
||||
const char *p2 = fname2;
|
||||
while (len > 0) {
|
||||
c1 = utf_ptr2char((const char_u *)p1);
|
||||
c2 = utf_ptr2char((const char_u *)p2);
|
||||
c1 = utf_ptr2char(p1);
|
||||
c2 = utf_ptr2char(p2);
|
||||
if ((c1 == NUL || c2 == NUL
|
||||
|| (!((c1 == '/' || c1 == '\\') && (c2 == '\\' || c2 == '/'))))
|
||||
&& (p_fic ? (c1 != c2 && CH_FOLD(c1) != CH_FOLD(c2)) : c1 != c2)) {
|
||||
break;
|
||||
}
|
||||
len -= (size_t)utfc_ptr2len((const char_u *)p1);
|
||||
p1 += utfc_ptr2len((const char_u *)p1);
|
||||
p2 += utfc_ptr2len((const char_u *)p2);
|
||||
len -= (size_t)utfc_ptr2len(p1);
|
||||
p1 += utfc_ptr2len(p1);
|
||||
p2 += utfc_ptr2len(p2);
|
||||
}
|
||||
return p_fic ? CH_FOLD(c1) - CH_FOLD(c2) : c1 - c2;
|
||||
#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)
|
||||
{
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
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));
|
||||
set_vim_var_string(VV_FNAME, NULL, 0);
|
||||
return res;
|
||||
|
@ -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.
|
||||
if (errorformat == p_efm && tv == NULL && buf && *buf->b_p_efm != NUL) {
|
||||
efm = (char *)buf->b_p_efm;
|
||||
efm = buf->b_p_efm;
|
||||
} else {
|
||||
efm = errorformat;
|
||||
}
|
||||
@ -2534,7 +2534,7 @@ static int qf_open_new_file_win(qf_info_T *ll_ref)
|
||||
if (win_split(0, flags) == FAIL) {
|
||||
return FAIL; // not enough room for window
|
||||
}
|
||||
p_swb = empty_option; // don't split again
|
||||
p_swb = (char_u *)empty_option; // don't split again
|
||||
swb_flags = 0;
|
||||
RESET_BINDING(curwin);
|
||||
if (ll_ref != NULL) {
|
||||
@ -2994,7 +2994,7 @@ theend:
|
||||
qfl->qf_ptr = qf_ptr;
|
||||
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
|
||||
// modeline has changed the value.
|
||||
p_swb = (char_u *)old_swb;
|
||||
@ -4183,7 +4183,7 @@ int grep_internal(cmdidx_T cmdidx)
|
||||
|| cmdidx == CMD_grepadd
|
||||
|| cmdidx == CMD_lgrepadd)
|
||||
&& 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.
|
||||
@ -4241,7 +4241,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname)
|
||||
// Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd"
|
||||
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".
|
||||
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);
|
||||
}
|
||||
|
||||
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)) {
|
||||
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.
|
||||
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;
|
||||
}
|
||||
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!
|
||||
aco_save_T aco;
|
||||
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);
|
||||
aucmd_restbuf(&aco);
|
||||
}
|
||||
@ -7065,7 +7065,7 @@ void ex_helpgrep(exarg_T *eap)
|
||||
bool updated = false;
|
||||
// Make 'cpoptions' empty, the 'l' flag should not be used here.
|
||||
char *const save_cpo = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
|
||||
bool new_qi = false;
|
||||
if (is_loclist_cmd(eap->cmdidx)) {
|
||||
@ -7096,7 +7096,7 @@ void ex_helpgrep(exarg_T *eap)
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if ((char_u *)p_cpo == empty_option) {
|
||||
if (p_cpo == empty_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// 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) {
|
||||
set_option_value_give_err("cpo", 0L, save_cpo, 0);
|
||||
}
|
||||
free_string_option((char_u *)save_cpo);
|
||||
free_string_option(save_cpo);
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
|
@ -69,7 +69,7 @@ bool conceal_cursor_line(const win_T *wp)
|
||||
} else {
|
||||
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
|
||||
@ -535,7 +535,7 @@ bool get_keymap_str(win_T *wp, char *fmt, char *buf, int len)
|
||||
curwin = old_curwin;
|
||||
if (p == NULL || *p == NUL) {
|
||||
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 {
|
||||
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 },
|
||||
};
|
||||
|
||||
if (varp == &p_lcs || varp == &wp->w_p_lcs) {
|
||||
if (varp == &p_lcs || varp == (char_u **)&wp->w_p_lcs) {
|
||||
tab = 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;
|
||||
}
|
||||
} else {
|
||||
tab = 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;
|
||||
}
|
||||
}
|
||||
@ -1370,7 +1370,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
||||
*(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.tab3 = NUL;
|
||||
|
||||
@ -1439,7 +1439,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
||||
if (i == entries) {
|
||||
len = (int)STRLEN("multispace");
|
||||
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
|
||||
&& p[len] == ':'
|
||||
&& p[len + 1] != NUL) {
|
||||
@ -1470,7 +1470,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool set)
|
||||
}
|
||||
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
|
||||
&& p[len2] == ':'
|
||||
&& p[len2 + 1] != NUL) {
|
||||
@ -1527,10 +1527,10 @@ char *check_chars_options(void)
|
||||
return e_conflicts_with_value_of_fillchars;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char_u *ptr = curbuf->b_p_mps;
|
||||
char *ptr = curbuf->b_p_mps;
|
||||
|
||||
while (*ptr != NUL) {
|
||||
if (utf_ptr2char((char *)ptr) == *initc) {
|
||||
if (utf_ptr2char(ptr) == *initc) {
|
||||
if (switchit) {
|
||||
*findc = *initc;
|
||||
*initc = utf_ptr2char((char *)ptr + utfc_ptr2len((char *)ptr) + 1);
|
||||
*initc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1);
|
||||
*backwards = true;
|
||||
} else {
|
||||
*findc = utf_ptr2char((char *)ptr + utfc_ptr2len((char *)ptr) + 1);
|
||||
*findc = utf_ptr2char(ptr + utfc_ptr2len(ptr) + 1);
|
||||
*backwards = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
char_u *prev = ptr;
|
||||
ptr += utfc_ptr2len((char *)ptr) + 1;
|
||||
if (utf_ptr2char((char *)ptr) == *initc) {
|
||||
char *prev = ptr;
|
||||
ptr += utfc_ptr2len(ptr) + 1;
|
||||
if (utf_ptr2char(ptr) == *initc) {
|
||||
if (switchit) {
|
||||
*findc = *initc;
|
||||
*initc = utf_ptr2char((char *)prev);
|
||||
*initc = utf_ptr2char(prev);
|
||||
*backwards = false;
|
||||
} else {
|
||||
*findc = utf_ptr2char((char *)prev);
|
||||
*findc = utf_ptr2char(prev);
|
||||
*backwards = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ptr += utfc_ptr2len((char *)ptr);
|
||||
ptr += utfc_ptr2len(ptr);
|
||||
if (*ptr == ',') {
|
||||
ptr++;
|
||||
}
|
||||
@ -2376,7 +2376,7 @@ void showmatch(int c)
|
||||
* Only show match for chars in the 'matchpairs' option.
|
||||
*/
|
||||
// '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)) {
|
||||
break;
|
||||
}
|
||||
@ -4090,8 +4090,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
|
||||
if (col_start < 0) {
|
||||
goto abort_search;
|
||||
}
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar,
|
||||
curbuf->b_p_qe);
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
|
||||
if (col_end < 0) {
|
||||
// We were on a starting quote perhaps?
|
||||
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) {
|
||||
goto abort_search;
|
||||
}
|
||||
col_start = find_prev_quote(line, col_end, quotechar,
|
||||
curbuf->b_p_qe);
|
||||
col_start = find_prev_quote(line, col_end, quotechar, (char_u *)curbuf->b_p_qe);
|
||||
if (line[col_start] != quotechar) {
|
||||
// We were on an ending quote perhaps?
|
||||
col_start = col_end;
|
||||
@ -4132,8 +4130,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
|
||||
goto abort_search;
|
||||
}
|
||||
// Find close quote character.
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar,
|
||||
curbuf->b_p_qe);
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
|
||||
if (col_end < 0) {
|
||||
goto abort_search;
|
||||
}
|
||||
@ -4146,7 +4143,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
|
||||
}
|
||||
} else {
|
||||
// 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) {
|
||||
// No quote before the cursor, look after the cursor.
|
||||
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.
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar,
|
||||
curbuf->b_p_qe);
|
||||
col_end = find_next_quote(line, col_start + 1, quotechar, (char_u *)curbuf->b_p_qe);
|
||||
if (col_end < 0) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
incl_regmatch.regprog = vim_regcomp((char *)inc_opt, p_magic ? RE_MAGIC : 0);
|
||||
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)) {
|
||||
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);
|
||||
if (def_regmatch.regprog == NULL) {
|
||||
goto fpip_end;
|
||||
|
@ -1837,7 +1837,7 @@ char *did_set_spelllang(win_T *wp)
|
||||
|
||||
// Make a copy of 'spelllang', the SpellFileMissing autocommands may change
|
||||
// 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;
|
||||
|
||||
@ -1966,7 +1966,7 @@ char *did_set_spelllang(win_T *wp)
|
||||
// round 1: load first name in 'spellfile'.
|
||||
// round 2: load second name in 'spellfile.
|
||||
// etc.
|
||||
spf = (char *)curwin->w_s->b_p_spf;
|
||||
spf = curwin->w_s->b_p_spf;
|
||||
for (round = 0; round == 0 || *spf != NUL; round++) {
|
||||
if (round == 0) {
|
||||
// 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;
|
||||
} else if (wp->w_s->b_spell_ismw_mb == NULL) {
|
||||
// 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 {
|
||||
// Append multi-byte chars to "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);
|
||||
wp->w_s->b_spell_ismw_mb = bp;
|
||||
wp->w_s->b_spell_ismw_mb = (char *)bp;
|
||||
STRLCPY(bp + n, p, l + 1);
|
||||
}
|
||||
p += l;
|
||||
@ -2359,7 +2359,7 @@ bool spell_iswordp(const char_u *p, const win_T *wp)
|
||||
if (c < 256
|
||||
? wp->w_s->b_spell_ismw[c]
|
||||
: (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;
|
||||
}
|
||||
}
|
||||
@ -2405,7 +2405,7 @@ static bool spell_iswordp_w(const int *p, const win_T *wp)
|
||||
|
||||
if (*p <
|
||||
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)) {
|
||||
s = p + 1;
|
||||
} else {
|
||||
@ -3599,7 +3599,7 @@ char *compile_cap_prog(synblock_T *synblock)
|
||||
synblock->b_cap_prog = NULL;
|
||||
} else {
|
||||
// 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);
|
||||
xfree(re);
|
||||
if (synblock->b_cap_prog == NULL) {
|
||||
|
@ -4877,12 +4877,12 @@ void ex_mkspell(exarg_T *eap)
|
||||
{
|
||||
int fcount;
|
||||
char **fnames;
|
||||
char_u *arg = (char_u *)eap->arg;
|
||||
char *arg = eap->arg;
|
||||
bool ascii = false;
|
||||
|
||||
if (STRNCMP(arg, "-ascii", 6) == 0) {
|
||||
ascii = true;
|
||||
arg = (char_u *)skipwhite((char *)arg + 6);
|
||||
arg = skipwhite(arg + 6);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
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, ",");
|
||||
if (i == idx) {
|
||||
break;
|
||||
@ -5680,14 +5680,14 @@ static void init_spellfile(void)
|
||||
char_u *rtp;
|
||||
char_u *lend;
|
||||
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)) {
|
||||
buf = xmalloc(MAXPATHL);
|
||||
|
||||
// Find the end of the language name. Exclude the region. If there
|
||||
// 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++) {
|
||||
if (vim_ispathsep(*lend)) {
|
||||
aspath = true;
|
||||
@ -5702,8 +5702,7 @@ static void init_spellfile(void)
|
||||
if (aspath) {
|
||||
// Use directory of an entry with path, e.g., for
|
||||
// "/dir/lg.utf-8.spl" use "/dir".
|
||||
STRLCPY(buf, curbuf->b_s.b_p_spl,
|
||||
lstart - curbuf->b_s.b_p_spl);
|
||||
STRLCPY(buf, curbuf->b_s.b_p_spl, lstart - (char_u *)curbuf->b_s.b_p_spl);
|
||||
} else {
|
||||
// Copy the path from 'runtimepath' to buf[].
|
||||
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
|
||||
// encoding used in the first loaded .spl file.
|
||||
if (aspath) {
|
||||
STRLCPY(buf, curbuf->b_s.b_p_spl,
|
||||
lend - curbuf->b_s.b_p_spl + 1);
|
||||
STRLCPY(buf, curbuf->b_s.b_p_spl, lend - (char_u *)curbuf->b_s.b_p_spl + 1);
|
||||
} else {
|
||||
// Create the "spell" directory if it doesn't exist yet.
|
||||
l = (int)STRLEN(buf);
|
||||
|
@ -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);
|
||||
} else {
|
||||
if (*wp->w_p_stl != NUL) {
|
||||
stl = wp->w_p_stl;
|
||||
stl = (char_u *)wp->w_p_stl;
|
||||
} else {
|
||||
stl = p_stl;
|
||||
}
|
||||
|
@ -3162,7 +3162,7 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
|
||||
msg_puts("\n");
|
||||
if (curwin->w_s->b_syn_isk != empty_option) {
|
||||
msg_puts("syntax iskeyword ");
|
||||
msg_outtrans((char *)curwin->w_s->b_syn_isk);
|
||||
msg_outtrans(curwin->w_s->b_syn_isk);
|
||||
} else {
|
||||
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);
|
||||
} else {
|
||||
memmove(save_chartab, curbuf->b_chartab, (size_t)32);
|
||||
save_isk = curbuf->b_p_isk;
|
||||
curbuf->b_p_isk = vim_strsave(arg);
|
||||
save_isk = (char_u *)curbuf->b_p_isk;
|
||||
curbuf->b_p_isk = (char *)vim_strsave(arg);
|
||||
|
||||
buf_init_chartab(curbuf, false);
|
||||
memmove(curwin->w_s->b_syn_chartab, curbuf->b_chartab, (size_t)32);
|
||||
memmove(curbuf->b_chartab, save_chartab, (size_t)32);
|
||||
clear_string_option(&curwin->w_s->b_syn_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);
|
||||
@ -5070,7 +5070,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
|
||||
|
||||
// Make 'cpoptions' empty, to avoid the 'l' flag
|
||||
cpo_save = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
ci->sp_prog = vim_regcomp((char *)ci->sp_pattern, RE_MAGIC);
|
||||
p_cpo = cpo_save;
|
||||
|
||||
@ -5226,14 +5226,14 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
|
||||
if (!eap->skip) {
|
||||
// store the pattern and compiled regexp program
|
||||
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;
|
||||
|
||||
// Make 'cpoptions' empty, to avoid the 'l' flag
|
||||
cpo_save = p_cpo;
|
||||
p_cpo = (char *)empty_option;
|
||||
p_cpo = empty_option;
|
||||
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;
|
||||
syn_clear_time(&curwin->w_s->b_syn_linecont_time);
|
||||
|
||||
|
@ -202,7 +202,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
|
||||
}
|
||||
|
||||
prev_num_matches = num_matches;
|
||||
free_string_option(nofile_fname);
|
||||
free_string_option((char *)nofile_fname);
|
||||
nofile_fname = NULL;
|
||||
|
||||
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;
|
||||
if (g_do_tagpreview != 0) {
|
||||
tagstack_clear_entry(&ptag_entry);
|
||||
ptag_entry.tagname = vim_strsave(tag);
|
||||
ptag_entry.tagname = (char *)vim_strsave(tag);
|
||||
}
|
||||
} else {
|
||||
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;
|
||||
} else {
|
||||
tagstack_clear_entry(&ptag_entry);
|
||||
ptag_entry.tagname = vim_strsave(tag);
|
||||
ptag_entry.tagname = (char *)vim_strsave(tag);
|
||||
}
|
||||
} 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
|
||||
tagstack[tagstackidx].tagname = vim_strsave(tag);
|
||||
tagstack[tagstackidx].tagname = (char *)vim_strsave(tag);
|
||||
|
||||
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).
|
||||
if (use_tagstack) {
|
||||
name = tagstack[tagstackidx].tagname;
|
||||
name = (char_u *)tagstack[tagstackidx].tagname;
|
||||
} else if (g_do_tagpreview != 0) {
|
||||
name = ptag_entry.tagname;
|
||||
name = (char_u *)ptag_entry.tagname;
|
||||
} else {
|
||||
name = tag;
|
||||
}
|
||||
@ -587,7 +587,7 @@ 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
|
||||
&& tagp2.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 -
|
||||
tagp2.user_data));
|
||||
}
|
||||
@ -1184,7 +1184,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
|
||||
flags & TAG_REGEXP ? "r": "");
|
||||
|
||||
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
|
||||
d->dv_refcount--;
|
||||
|
||||
@ -2388,7 +2388,7 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
|
||||
if (first) {
|
||||
// Init. We make a copy of 'tags', because autocommands may change
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -3365,7 +3365,7 @@ static void tagstack_push_item(win_T *wp, char_u *tagname, int cur_fnum, int cur
|
||||
}
|
||||
|
||||
wp->w_tagstacklen++;
|
||||
tagstack[idx].tagname = tagname;
|
||||
tagstack[idx].tagname = (char *)tagname;
|
||||
tagstack[idx].cur_fnum = cur_fnum;
|
||||
tagstack[idx].cur_match = cur_match;
|
||||
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.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
|
||||
|
@ -418,7 +418,7 @@ bool terminal_enter(void)
|
||||
// placed at end of buffer to "follow" output. #11072
|
||||
handle_T save_curwin = curwin->handle;
|
||||
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;
|
||||
int save_w_p_cuc = curwin->w_p_cuc;
|
||||
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 (STRCMP(curwin->w_p_culopt, "number")) {
|
||||
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;
|
||||
} else {
|
||||
|
@ -457,7 +457,7 @@ void f_assert_exception(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
ga_clear(&ga);
|
||||
rettv->vval.v_number = 1;
|
||||
} 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);
|
||||
fill_assert_error(&ga, &argvars[1], NULL, &argvars[0],
|
||||
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);
|
||||
|
||||
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);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
|
||||
get_vim_var_tv(VV_ERRMSG), ASSERT_OTHER);
|
||||
|
@ -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);
|
||||
size_t len = buf->b_u_line_ptr ? STRLEN(buf->b_u_line_ptr) : 0;
|
||||
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;
|
||||
}
|
||||
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_newhead = new_idx < 0 ? NULL : uhp_table[new_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_colnr = line_colnr;
|
||||
curbuf->b_u_numhead = num_head;
|
||||
@ -2960,7 +2960,7 @@ void u_saveline(linenr_T lnum)
|
||||
} else {
|
||||
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
|
||||
@ -2992,12 +2992,12 @@ void u_undoline(void)
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
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;
|
||||
if (curwin->w_cursor.lnum == curbuf->b_u_line_lnum) {
|
||||
|
@ -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.
|
||||
int 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) {
|
||||
width = l;
|
||||
@ -2084,7 +2084,7 @@ void list_in_columns(char **items, int size, int current)
|
||||
if (Columns < width) {
|
||||
// Not enough screen columns - show one per line
|
||||
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) {
|
||||
msg_putchar('\n');
|
||||
}
|
||||
@ -2106,7 +2106,7 @@ void list_in_columns(char **items, int size, int current)
|
||||
if (idx == current) {
|
||||
msg_putchar('[');
|
||||
}
|
||||
msg_puts((char *)items[idx]);
|
||||
msg_puts(items[idx]);
|
||||
if (idx == current) {
|
||||
msg_putchar(']');
|
||||
}
|
||||
|
@ -727,38 +727,38 @@ void win_set_minimal_style(win_T *wp)
|
||||
|
||||
// Hide EOB region: use " " fillchar and cleared highlighting
|
||||
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)
|
||||
? (char_u *)xstrdup("eob: ")
|
||||
: concat_str(old, (char_u *)",eob: "));
|
||||
free_string_option(old);
|
||||
? xstrdup("eob: ")
|
||||
: (char *)concat_str(old, (char_u *)",eob: "));
|
||||
free_string_option((char *)old);
|
||||
}
|
||||
|
||||
// TODO(bfredl): this could use a highlight namespace directly,
|
||||
// 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)
|
||||
? (char_u *)xstrdup("EndOfBuffer:")
|
||||
: concat_str(old, (char_u *)",EndOfBuffer:"));
|
||||
free_string_option(old);
|
||||
? xstrdup("EndOfBuffer:")
|
||||
: (char *)concat_str(old, (char_u *)",EndOfBuffer:"));
|
||||
free_string_option((char *)old);
|
||||
parse_winhl_opt(wp);
|
||||
|
||||
// signcolumn: use 'auto'
|
||||
if (wp->w_p_scl[0] != 'a' || STRLEN(wp->w_p_scl) >= 8) {
|
||||
free_string_option(wp->w_p_scl);
|
||||
wp->w_p_scl = (char_u *)xstrdup("auto");
|
||||
wp->w_p_scl = xstrdup("auto");
|
||||
}
|
||||
|
||||
// foldcolumn: use '0'
|
||||
if (wp->w_p_fdc[0] != '0') {
|
||||
free_string_option(wp->w_p_fdc);
|
||||
wp->w_p_fdc = (char_u *)xstrdup("0");
|
||||
wp->w_p_fdc = xstrdup("0");
|
||||
}
|
||||
|
||||
// colorcolumn: cleared
|
||||
if (wp->w_p_cc != NULL && *wp->w_p_cc != NUL) {
|
||||
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];
|
||||
*tag = oldp->w_tagstack[i];
|
||||
if (tag->tagname != NULL) {
|
||||
tag->tagname = vim_strsave(tag->tagname);
|
||||
tag->tagname = xstrdup(tag->tagname);
|
||||
}
|
||||
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;
|
||||
@ -7291,7 +7291,7 @@ char *check_colorcolumn(win_T *wp)
|
||||
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 == '+') {
|
||||
// -N and +N: add to 'textwidth'
|
||||
col = (*s == '-') ? -1 : 1;
|
||||
|
Loading…
Reference in New Issue
Block a user