mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
refactor(options): rename empty_option
to empty_string_option
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user