Make a function for NODUMP.

This commit is contained in:
Nick Mathewson 2019-08-24 17:40:38 -04:00
parent eb54fe8f97
commit 078ba326a1
2 changed files with 7 additions and 1 deletions

View File

@ -169,6 +169,11 @@ config_var_is_invisible(const config_var_t *var)
{ {
return (var->flags & CVFLAG_INVISIBLE) != 0; return (var->flags & CVFLAG_INVISIBLE) != 0;
} }
bool
config_var_is_dumpable(const config_var_t *var)
{
return (var->flags & CVFLAG_NODUMP) == 0;
}
/* /*
* Functions to assign config options. * Functions to assign config options.
@ -646,7 +651,7 @@ config_dump(const config_format_t *fmt, const void *default_options,
continue; continue;
} }
/* Don't save 'hidden' control variables. */ /* Don't save 'hidden' control variables. */
if (fmt->vars[i].flags & CVFLAG_NODUMP) if (! config_var_is_dumpable(&fmt->vars[i]))
continue; continue;
if (minimal && config_is_same(fmt, options, defaults, if (minimal && config_is_same(fmt, options, defaults,
fmt->vars[i].member.name)) fmt->vars[i].member.name))

View File

@ -108,6 +108,7 @@ bool config_var_is_cumulative(const config_var_t *var);
bool config_var_is_settable(const config_var_t *var); bool config_var_is_settable(const config_var_t *var);
bool config_var_is_contained(const config_var_t *var); bool config_var_is_contained(const config_var_t *var);
bool config_var_is_invisible(const config_var_t *var); bool config_var_is_invisible(const config_var_t *var);
bool config_var_is_dumpable(const config_var_t *var);
/* Helper macros to compare an option across two configuration objects */ /* Helper macros to compare an option across two configuration objects */
#define CFG_EQ_BOOL(a,b,opt) ((a)->opt == (b)->opt) #define CFG_EQ_BOOL(a,b,opt) ((a)->opt == (b)->opt)