aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index c1ab3f2ee5..5b5570fad4 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1808,7 +1808,7 @@ static struct vimoption
}
};
-#define PARAM_COUNT (sizeof(options) / sizeof(struct vimoption))
+#define PARAM_COUNT ARRAY_SIZE(options)
static char *(p_ambw_values[]) = {"single", "double", NULL};
static char *(p_bg_values[]) = {"light", "dark", NULL};
@@ -1883,7 +1883,7 @@ void set_init_1(void)
int mustfree;
ga_init(&ga, 1, 100);
- for (n = 0; n < (long)(sizeof(names) / sizeof(char *)); ++n) {
+ for (n = 0; n < (long)ARRAY_SIZE(names); ++n) {
mustfree = FALSE;
# ifdef UNIX
if (*names[n] == NUL)
@@ -4723,10 +4723,10 @@ static char_u *set_chars_option(char_u **varp)
if (varp == &p_lcs) {
tab = lcstab;
- entries = sizeof(lcstab) / sizeof(struct charstab);
+ entries = ARRAY_SIZE(lcstab);
} else {
tab = filltab;
- entries = sizeof(filltab) / sizeof(struct charstab);
+ entries = ARRAY_SIZE(filltab);
}
/* first round: check for valid value, second round: assign values */
@@ -6196,15 +6196,17 @@ int makeset(FILE *fd, int opt_flags, int local_only)
int pri;
/*
- * The options that don't have a default (terminal name, columns, lines)
- * are never written. Terminal options are also not written.
+ * Some options are never written:
+ * - Options that don't have a default (terminal name, columns, lines).
+ * - Terminal options.
+ * - Hidden options.
+ *
* Do the loop over "options[]" twice: once for options with the
* P_PRI_MKRC flag and once without.
*/
for (pri = 1; pri >= 0; --pri) {
for (p = &options[0]; !istermoption(p); p++)
if (!(p->flags & P_NO_MKRC)
- && !istermoption(p)
&& ((pri == 1) == ((p->flags & P_PRI_MKRC) != 0))) {
/* skip global option when only doing locals */
if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL))
@@ -6215,8 +6217,11 @@ int makeset(FILE *fd, int opt_flags, int local_only)
if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB))
continue;
- /* Global values are only written when not at the default value. */
varp = get_varp_scope(p, opt_flags);
+ /* Hidden options are never written. */
+ if (!varp)
+ continue;
+ /* Global values are only written when not at the default value. */
if ((opt_flags & OPT_GLOBAL) && optval_default(p, varp))
continue;
@@ -7245,7 +7250,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
for (loop = 0; loop <= 1; ++loop) {
regmatch->rm_ic = ic;
if (xp->xp_context != EXPAND_BOOL_SETTINGS) {
- for (match = 0; match < (int)(sizeof(names) / sizeof(char *));
+ for (match = 0; match < (int)ARRAY_SIZE(names);
++match)
if (vim_regexec(regmatch, (char_u *)names[match], (colnr_T)0)) {
if (loop == 0)