mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 05:05:00 -07:00
refactor(options): rename empty_option
to empty_string_option
This commit is contained in:
parent
526234cf56
commit
af010e23f3
@ -140,7 +140,7 @@ void alist_expand(int *fnum_list, int fnum_len)
|
||||
// Don't use 'suffixes' here. This should work like the shell did the
|
||||
// expansion. Also, the vimrc file isn't read yet, thus the user
|
||||
// can't set the options.
|
||||
p_su = empty_option;
|
||||
p_su = empty_string_option;
|
||||
for (int i = 0; i < GARGCOUNT; i++) {
|
||||
old_arg_files[i] = xstrdup(GARGLIST[i].ae_fname);
|
||||
}
|
||||
|
@ -2237,7 +2237,7 @@ int pattern_match(const char *pat, const char *text, bool ic)
|
||||
|
||||
// avoid 'l' flag in 'cpoptions'
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
|
||||
if (regmatch.regprog != NULL) {
|
||||
regmatch.rm_ic = ic;
|
||||
@ -8645,7 +8645,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, const char
|
||||
|
||||
// Make 'cpoptions' empty, so that the 'l' flag doesn't work here
|
||||
char *save_cpo = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
ga_init(&ga, 1, 200);
|
||||
|
||||
@ -8710,7 +8710,7 @@ char *do_string_sub(char *str, char *pat, char *sub, typval_T *expr, const char
|
||||
|
||||
char *ret = xstrdup(ga.ga_data == NULL ? str : ga.ga_data);
|
||||
ga_clear(&ga);
|
||||
if (p_cpo == empty_option) {
|
||||
if (p_cpo == empty_string_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// Darn, evaluating {sub} expression or {expr} changed the value.
|
||||
|
@ -482,7 +482,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 = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
buf_T *buf = buflist_findnr(buflist_findpat(name, name + strlen(name),
|
||||
true, false, curtab_only));
|
||||
@ -1733,7 +1733,7 @@ static void f_expand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
char *p_csl_save = p_csl;
|
||||
|
||||
// avoid using 'completeslash' here
|
||||
p_csl = empty_option;
|
||||
p_csl = empty_string_option;
|
||||
#endif
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
@ -4516,7 +4516,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 = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
switch (type) {
|
||||
@ -7108,7 +7108,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 = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
// Set the time limit, if there is one.
|
||||
proftime_T tm = profile_setlimit(time_limit);
|
||||
@ -7234,7 +7234,7 @@ long do_searchpair(const char *spat, const char *mpat, const char *epat, int dir
|
||||
|
||||
xfree(pat2);
|
||||
xfree(pat3);
|
||||
if (p_cpo == empty_option) {
|
||||
if (p_cpo == empty_string_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// Darn, evaluating the {skip} expression changed the value.
|
||||
@ -7966,7 +7966,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 = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
const char *str = tv_get_string(&argvars[0]);
|
||||
const char *pat = NULL;
|
||||
|
@ -1342,7 +1342,7 @@ void ex_catch(exarg_T *eap)
|
||||
*end = NUL;
|
||||
}
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
// Disable error messages, it will make current exception
|
||||
// invalid
|
||||
emsg_off++;
|
||||
|
@ -789,10 +789,11 @@ EXTERN char *escape_chars INIT(= " \t\\\"|"); // need backslash in cmd line
|
||||
|
||||
EXTERN bool 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 *empty_option INIT(= "");
|
||||
// When a string option is NULL (which only happens in out-of-memory situations), it is set to
|
||||
// empty_string_option, to avoid having to check for NULL everywhere.
|
||||
//
|
||||
// TODO(famiu): Remove this when refcounted strings are used for string options.
|
||||
EXTERN char *empty_string_option INIT(= "");
|
||||
|
||||
EXTERN bool redir_off INIT(= false); // no redirection for a moment
|
||||
EXTERN FILE *redir_fd INIT(= NULL); // message redirection file
|
||||
|
@ -1878,8 +1878,8 @@ void clear_showcmd(void)
|
||||
char *const saved_w_sbr = curwin->w_p_sbr;
|
||||
|
||||
// Make 'sbr' empty for a moment to get the correct size.
|
||||
p_sbr = empty_option;
|
||||
curwin->w_p_sbr = empty_option;
|
||||
p_sbr = empty_string_option;
|
||||
curwin->w_p_sbr = empty_string_option;
|
||||
getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol);
|
||||
p_sbr = saved_sbr;
|
||||
curwin->w_p_sbr = saved_w_sbr;
|
||||
|
@ -5365,8 +5365,8 @@ void cursor_pos_info(dict_T *dict)
|
||||
char *const saved_w_sbr = curwin->w_p_sbr;
|
||||
|
||||
// Make 'sbr' empty for a moment to get the correct size.
|
||||
p_sbr = empty_option;
|
||||
curwin->w_p_sbr = empty_option;
|
||||
p_sbr = empty_string_option;
|
||||
curwin->w_p_sbr = empty_string_option;
|
||||
oparg.is_VIsual = true;
|
||||
oparg.motion_type = kMTBlockWise;
|
||||
oparg.op_type = OP_NOP;
|
||||
|
@ -761,7 +761,7 @@ static char *stropt_get_default_val(int opt_idx, uint64_t flags)
|
||||
// already expanded, only required when an environment variable was set
|
||||
// later
|
||||
if (newval == NULL) {
|
||||
newval = empty_option;
|
||||
newval = empty_string_option;
|
||||
} else if (!(options[opt_idx].flags & P_NO_DEF_EXP)) {
|
||||
char *s = option_expand(opt_idx, newval);
|
||||
if (s == NULL) {
|
||||
@ -2294,7 +2294,7 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (buf->b_p_vsts_nopaste) {
|
||||
xfree(buf->b_p_vsts_nopaste);
|
||||
}
|
||||
buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_option
|
||||
buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_string_option
|
||||
? xstrdup(buf->b_p_vsts)
|
||||
: NULL;
|
||||
}
|
||||
@ -2313,7 +2313,7 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (p_vsts_nopaste) {
|
||||
xfree(p_vsts_nopaste);
|
||||
}
|
||||
p_vsts_nopaste = p_vsts && p_vsts != empty_option ? xstrdup(p_vsts) : NULL;
|
||||
p_vsts_nopaste = p_vsts && p_vsts != empty_string_option ? xstrdup(p_vsts) : NULL;
|
||||
}
|
||||
|
||||
// Always set the option values, also when 'paste' is set when it is
|
||||
@ -2328,7 +2328,7 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (buf->b_p_vsts) {
|
||||
free_string_option(buf->b_p_vsts);
|
||||
}
|
||||
buf->b_p_vsts = empty_option;
|
||||
buf->b_p_vsts = empty_string_option;
|
||||
XFREE_CLEAR(buf->b_p_vsts_array);
|
||||
}
|
||||
|
||||
@ -2349,7 +2349,7 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (p_vsts) {
|
||||
free_string_option(p_vsts);
|
||||
}
|
||||
p_vsts = empty_option;
|
||||
p_vsts = empty_string_option;
|
||||
} else if (old_p_paste) {
|
||||
// Paste switched from on to off: Restore saved values.
|
||||
|
||||
@ -2363,9 +2363,9 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (buf->b_p_vsts) {
|
||||
free_string_option(buf->b_p_vsts);
|
||||
}
|
||||
buf->b_p_vsts = buf->b_p_vsts_nopaste ? xstrdup(buf->b_p_vsts_nopaste) : empty_option;
|
||||
buf->b_p_vsts = buf->b_p_vsts_nopaste ? xstrdup(buf->b_p_vsts_nopaste) : empty_string_option;
|
||||
xfree(buf->b_p_vsts_array);
|
||||
if (buf->b_p_vsts && buf->b_p_vsts != empty_option) {
|
||||
if (buf->b_p_vsts && buf->b_p_vsts != empty_string_option) {
|
||||
(void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
|
||||
} else {
|
||||
buf->b_p_vsts_array = NULL;
|
||||
@ -2389,7 +2389,7 @@ static const char *did_set_paste(optset_T *args FUNC_ATTR_UNUSED)
|
||||
if (p_vsts) {
|
||||
free_string_option(p_vsts);
|
||||
}
|
||||
p_vsts = p_vsts_nopaste ? xstrdup(p_vsts_nopaste) : empty_option;
|
||||
p_vsts = p_vsts_nopaste ? xstrdup(p_vsts_nopaste) : empty_string_option;
|
||||
}
|
||||
|
||||
old_p_paste = p_paste;
|
||||
@ -4789,8 +4789,8 @@ void win_copy_options(win_T *wp_from, win_T *wp_to)
|
||||
|
||||
static char *copy_option_val(const char *val)
|
||||
{
|
||||
if (val == empty_option) {
|
||||
return empty_option; // no need to allocate memory
|
||||
if (val == empty_string_option) {
|
||||
return empty_string_option; // no need to allocate memory
|
||||
}
|
||||
return xstrdup(val);
|
||||
}
|
||||
@ -4837,7 +4837,7 @@ void copy_winopt(winopt_T *from, winopt_T *to)
|
||||
to->wo_cocu = copy_option_val(from->wo_cocu);
|
||||
to->wo_cole = from->wo_cole;
|
||||
to->wo_fdc = copy_option_val(from->wo_fdc);
|
||||
to->wo_fdc_save = from->wo_diff_saved ? xstrdup(from->wo_fdc_save) : empty_option;
|
||||
to->wo_fdc_save = from->wo_diff_saved ? xstrdup(from->wo_fdc_save) : empty_string_option;
|
||||
to->wo_fen = from->wo_fen;
|
||||
to->wo_fen_save = from->wo_fen_save;
|
||||
to->wo_fdi = copy_option_val(from->wo_fdi);
|
||||
@ -4845,7 +4845,7 @@ void copy_winopt(winopt_T *from, winopt_T *to)
|
||||
to->wo_fdl = from->wo_fdl;
|
||||
to->wo_fdl_save = from->wo_fdl_save;
|
||||
to->wo_fdm = copy_option_val(from->wo_fdm);
|
||||
to->wo_fdm_save = from->wo_diff_saved ? xstrdup(from->wo_fdm_save) : empty_option;
|
||||
to->wo_fdm_save = from->wo_diff_saved ? xstrdup(from->wo_fdm_save) : empty_string_option;
|
||||
to->wo_fdn = from->wo_fdn;
|
||||
to->wo_fde = copy_option_val(from->wo_fde);
|
||||
to->wo_fdt = copy_option_val(from->wo_fdt);
|
||||
@ -4867,7 +4867,7 @@ void check_win_options(win_T *win)
|
||||
check_winopt(&win->w_allbuf_opt);
|
||||
}
|
||||
|
||||
/// Check for NULL pointers in a winopt_T and replace them with empty_option.
|
||||
/// Check for NULL pointers in a winopt_T and replace them with empty_string_option.
|
||||
static void check_winopt(winopt_T *wop)
|
||||
{
|
||||
check_string_option(&wop->wo_fdc);
|
||||
@ -5020,8 +5020,8 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
buf->b_p_ff = xstrdup(p_ff);
|
||||
break;
|
||||
}
|
||||
buf->b_p_bh = empty_option;
|
||||
buf->b_p_bt = empty_option;
|
||||
buf->b_p_bh = empty_string_option;
|
||||
buf->b_p_bt = empty_string_option;
|
||||
} else {
|
||||
free_buf_options(buf, false);
|
||||
}
|
||||
@ -5082,7 +5082,7 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
buf->b_p_sts_nopaste = p_sts_nopaste;
|
||||
buf->b_p_vsts = xstrdup(p_vsts);
|
||||
COPY_OPT_SCTX(buf, BV_VSTS);
|
||||
if (p_vsts && p_vsts != empty_option) {
|
||||
if (p_vsts && p_vsts != empty_string_option) {
|
||||
(void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
|
||||
} else {
|
||||
buf->b_p_vsts_array = NULL;
|
||||
@ -5118,7 +5118,7 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
COPY_OPT_SCTX(buf, BV_LOP);
|
||||
|
||||
// Don't copy 'filetype', it must be detected
|
||||
buf->b_p_ft = empty_option;
|
||||
buf->b_p_ft = empty_string_option;
|
||||
buf->b_p_pi = p_pi;
|
||||
COPY_OPT_SCTX(buf, BV_PI);
|
||||
buf->b_p_cinw = xstrdup(p_cinw);
|
||||
@ -5126,10 +5126,10 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
buf->b_p_lisp = p_lisp;
|
||||
COPY_OPT_SCTX(buf, BV_LISP);
|
||||
// Don't copy 'syntax', it must be set
|
||||
buf->b_p_syn = empty_option;
|
||||
buf->b_p_syn = empty_string_option;
|
||||
buf->b_p_smc = p_smc;
|
||||
COPY_OPT_SCTX(buf, BV_SMC);
|
||||
buf->b_s.b_syn_isk = empty_option;
|
||||
buf->b_s.b_syn_isk = empty_string_option;
|
||||
buf->b_s.b_p_spc = xstrdup(p_spc);
|
||||
COPY_OPT_SCTX(buf, BV_SPC);
|
||||
(void)compile_cap_prog(&buf->b_s);
|
||||
@ -5143,7 +5143,7 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
COPY_OPT_SCTX(buf, BV_INDE);
|
||||
buf->b_p_indk = xstrdup(p_indk);
|
||||
COPY_OPT_SCTX(buf, BV_INDK);
|
||||
buf->b_p_fp = empty_option;
|
||||
buf->b_p_fp = empty_string_option;
|
||||
buf->b_p_fex = xstrdup(p_fex);
|
||||
COPY_OPT_SCTX(buf, BV_FEX);
|
||||
buf->b_p_sua = xstrdup(p_sua);
|
||||
@ -5162,30 +5162,30 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
// are not copied, start using the global value
|
||||
buf->b_p_ar = -1;
|
||||
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
|
||||
buf->b_p_bkc = empty_option;
|
||||
buf->b_p_bkc = empty_string_option;
|
||||
buf->b_bkc_flags = 0;
|
||||
buf->b_p_gp = empty_option;
|
||||
buf->b_p_mp = empty_option;
|
||||
buf->b_p_efm = empty_option;
|
||||
buf->b_p_ep = empty_option;
|
||||
buf->b_p_kp = empty_option;
|
||||
buf->b_p_path = empty_option;
|
||||
buf->b_p_tags = empty_option;
|
||||
buf->b_p_tc = empty_option;
|
||||
buf->b_p_gp = empty_string_option;
|
||||
buf->b_p_mp = empty_string_option;
|
||||
buf->b_p_efm = empty_string_option;
|
||||
buf->b_p_ep = empty_string_option;
|
||||
buf->b_p_kp = empty_string_option;
|
||||
buf->b_p_path = empty_string_option;
|
||||
buf->b_p_tags = empty_string_option;
|
||||
buf->b_p_tc = empty_string_option;
|
||||
buf->b_tc_flags = 0;
|
||||
buf->b_p_def = empty_option;
|
||||
buf->b_p_inc = empty_option;
|
||||
buf->b_p_def = empty_string_option;
|
||||
buf->b_p_inc = empty_string_option;
|
||||
buf->b_p_inex = xstrdup(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_dict = empty_string_option;
|
||||
buf->b_p_tsr = empty_string_option;
|
||||
buf->b_p_tsrfu = empty_string_option;
|
||||
buf->b_p_qe = xstrdup(p_qe);
|
||||
COPY_OPT_SCTX(buf, BV_QE);
|
||||
buf->b_p_udf = p_udf;
|
||||
COPY_OPT_SCTX(buf, BV_UDF);
|
||||
buf->b_p_lw = empty_option;
|
||||
buf->b_p_menc = empty_option;
|
||||
buf->b_p_lw = empty_string_option;
|
||||
buf->b_p_menc = empty_string_option;
|
||||
|
||||
// Don't copy the options set by ex_help(), use the saved values,
|
||||
// when going from a help buffer to a non-help buffer.
|
||||
@ -5193,7 +5193,7 @@ 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) {
|
||||
if (p_vts && p_vts != empty_string_option && !buf->b_p_vts_array) {
|
||||
(void)tabstop_set(p_vts, &buf->b_p_vts_array);
|
||||
} else {
|
||||
buf->b_p_vts_array = NULL;
|
||||
@ -5206,7 +5206,7 @@ void buf_copy_options(buf_T *buf, int flags)
|
||||
COPY_OPT_SCTX(buf, BV_TS);
|
||||
buf->b_p_vts = xstrdup(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 != empty_string_option && !buf->b_p_vts_array) {
|
||||
(void)tabstop_set(p_vts, &buf->b_p_vts_array);
|
||||
} else {
|
||||
buf->b_p_vts_array = NULL;
|
||||
@ -6082,7 +6082,7 @@ char *get_showbreak_value(win_T *const win)
|
||||
return p_sbr;
|
||||
}
|
||||
if (strcmp(win->w_p_sbr, "NONE") == 0) {
|
||||
return empty_option;
|
||||
return empty_string_option;
|
||||
}
|
||||
return win->w_p_sbr;
|
||||
}
|
||||
|
@ -287,29 +287,28 @@ void check_buf_options(buf_T *buf)
|
||||
}
|
||||
|
||||
/// Free the string allocated for an option.
|
||||
/// Checks for the string being empty_option. This may happen if we're out of
|
||||
/// memory, xstrdup() returned NULL, which was replaced by empty_option by
|
||||
/// check_options().
|
||||
/// Checks for the string being empty_string_option. This may happen if we're out of memory,
|
||||
/// xstrdup() returned NULL, which was replaced by empty_string_option by check_options().
|
||||
/// Does NOT check for P_ALLOCED flag!
|
||||
void free_string_option(char *p)
|
||||
{
|
||||
if (p != empty_option) {
|
||||
if (p != empty_string_option) {
|
||||
xfree(p);
|
||||
}
|
||||
}
|
||||
|
||||
void clear_string_option(char **pp)
|
||||
{
|
||||
if (*pp != empty_option) {
|
||||
if (*pp != empty_string_option) {
|
||||
xfree(*pp);
|
||||
}
|
||||
*pp = empty_option;
|
||||
*pp = empty_string_option;
|
||||
}
|
||||
|
||||
void check_string_option(char **pp)
|
||||
{
|
||||
if (*pp == NULL) {
|
||||
*pp = empty_option;
|
||||
*pp = empty_string_option;
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +384,7 @@ void set_string_option_direct(const char *name, int opt_idx, const char *val, in
|
||||
// make the local value empty, so that the global value is used.
|
||||
if ((opt->indir & PV_BOTH) && both) {
|
||||
free_string_option(*varp);
|
||||
*varp = empty_option;
|
||||
*varp = empty_string_option;
|
||||
}
|
||||
if (set_sid != SID_NONE) {
|
||||
sctx_T script_ctx;
|
||||
@ -468,7 +467,7 @@ const char *set_string_option(const int opt_idx, void *varp, const char *value,
|
||||
|
||||
// A global-local string option might have an empty option as value to
|
||||
// indicate that the global value should be used.
|
||||
if (((int)opt->indir & PV_BOTH) && origval_l == empty_option) {
|
||||
if (((int)opt->indir & PV_BOTH) && origval_l == empty_string_option) {
|
||||
origval_l = origval_g;
|
||||
}
|
||||
}
|
||||
@ -482,7 +481,7 @@ const char *set_string_option(const int opt_idx, void *varp, const char *value,
|
||||
origval = oldval;
|
||||
}
|
||||
|
||||
*(char **)varp = xstrdup(value != NULL ? value : empty_option);
|
||||
*(char **)varp = xstrdup(value != NULL ? value : empty_string_option);
|
||||
|
||||
char *const saved_origval = (origval != NULL) ? xstrdup(origval) : NULL;
|
||||
char *const saved_oldval_l = (origval_l != NULL) ? xstrdup(origval_l) : 0;
|
||||
@ -2814,7 +2813,7 @@ const char *did_set_string_option(buf_T *buf, win_T *win, int opt_idx, char **va
|
||||
// the local value and make it empty
|
||||
char *p = get_varp_scope(opt, OPT_LOCAL);
|
||||
free_string_option(*(char **)p);
|
||||
*(char **)p = empty_option;
|
||||
*(char **)p = empty_string_option;
|
||||
} else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL) {
|
||||
// May set global value for local option.
|
||||
set_string_option_global(opt, varp);
|
||||
|
@ -2596,7 +2596,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 = empty_string_option; // don't split again
|
||||
swb_flags = 0;
|
||||
RESET_BINDING(curwin);
|
||||
if (ll_ref != NULL) {
|
||||
@ -3073,7 +3073,7 @@ theend:
|
||||
qfl->qf_ptr = qf_ptr;
|
||||
qfl->qf_index = qf_index;
|
||||
}
|
||||
if (p_swb != old_swb && p_swb == empty_option) {
|
||||
if (p_swb != old_swb && p_swb == empty_string_option) {
|
||||
// Restore old 'switchbuf' value, but not when an autocommand or
|
||||
// modeline has changed the value.
|
||||
p_swb = old_swb;
|
||||
@ -7201,7 +7201,7 @@ void ex_helpgrep(exarg_T *eap)
|
||||
// Make 'cpoptions' empty, the 'l' flag should not be used here.
|
||||
char *const save_cpo = p_cpo;
|
||||
const bool save_cpo_allocated = is_option_allocated("cpo");
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
|
||||
bool new_qi = false;
|
||||
if (is_loclist_cmd(eap->cmdidx)) {
|
||||
@ -7232,7 +7232,7 @@ void ex_helpgrep(exarg_T *eap)
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (p_cpo == empty_option) {
|
||||
if (p_cpo == empty_string_option) {
|
||||
p_cpo = save_cpo;
|
||||
} else {
|
||||
// Darn, some plugin changed the value. If it's still empty it was
|
||||
|
@ -729,7 +729,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
|
||||
|
||||
static void save_chartab(char *chartab)
|
||||
{
|
||||
if (syn_block->b_syn_isk == empty_option) {
|
||||
if (syn_block->b_syn_isk == empty_string_option) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -739,7 +739,7 @@ static void save_chartab(char *chartab)
|
||||
|
||||
static void restore_chartab(char *chartab)
|
||||
{
|
||||
if (syn_win->w_s->b_syn_isk != empty_option) {
|
||||
if (syn_win->w_s->b_syn_isk != empty_string_option) {
|
||||
memmove(syn_buf->b_chartab, chartab, (size_t)32);
|
||||
}
|
||||
}
|
||||
@ -2946,7 +2946,7 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
|
||||
arg = skipwhite(arg);
|
||||
if (*arg == NUL) {
|
||||
msg_puts("\n");
|
||||
if (curwin->w_s->b_syn_isk != empty_option) {
|
||||
if (curwin->w_s->b_syn_isk != empty_string_option) {
|
||||
msg_puts("syntax iskeyword ");
|
||||
msg_outtrans(curwin->w_s->b_syn_isk, 0);
|
||||
} else {
|
||||
@ -4758,7 +4758,7 @@ static char *get_syn_pattern(char *arg, synpat_T *ci)
|
||||
|
||||
// Make 'cpoptions' empty, to avoid the 'l' flag
|
||||
char *cpo_save = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
ci->sp_prog = vim_regcomp(ci->sp_pattern, RE_MAGIC);
|
||||
p_cpo = cpo_save;
|
||||
|
||||
@ -4915,7 +4915,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
|
||||
|
||||
// Make 'cpoptions' empty, to avoid the 'l' flag
|
||||
cpo_save = p_cpo;
|
||||
p_cpo = empty_option;
|
||||
p_cpo = empty_string_option;
|
||||
curwin->w_s->b_syn_linecont_prog =
|
||||
vim_regcomp(curwin->w_s->b_syn_linecont_pat, RE_MAGIC);
|
||||
p_cpo = cpo_save;
|
||||
@ -5298,7 +5298,7 @@ void ex_ownsyntax(exarg_T *eap)
|
||||
hash_init(&curwin->w_s->b_keywtab_ic);
|
||||
// TODO(vim): Keep the spell checking as it was.
|
||||
curwin->w_p_spell = false; // No spell checking
|
||||
// make sure option values are "empty_option" instead of NULL
|
||||
// make sure option values are "empty_string_option" instead of NULL
|
||||
clear_string_option(&curwin->w_s->b_p_spc);
|
||||
clear_string_option(&curwin->w_s->b_p_spf);
|
||||
clear_string_option(&curwin->w_s->b_p_spl);
|
||||
|
Loading…
Reference in New Issue
Block a user