mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Add a "flags" member to config_var_t
Additionally, adjust the macros so that we can add new members like this more easily.
This commit is contained in:
parent
c553750e32
commit
5b252d31ed
@ -19,7 +19,7 @@
|
||||
* Used to indicate the end of an array of configuration variables.
|
||||
**/
|
||||
#define END_OF_CONFIG_VARS \
|
||||
{ { .name = NULL }, NULL DUMMY_CONF_TEST_MEMBERS }
|
||||
{ .member = { .name = NULL } DUMMY_CONF_TEST_MEMBERS }
|
||||
|
||||
/**
|
||||
* Declare a config_var_t as a member named <b>membername</b> of the structure
|
||||
|
@ -68,8 +68,8 @@ typedef union {
|
||||
#define CONF_CHECK_VAR_TYPE(tp, conftype, member) \
|
||||
{ . conftype = &tp ## _dummy . member }
|
||||
#define CONF_TEST_MEMBERS(tp, conftype, member) \
|
||||
, CONF_CHECK_VAR_TYPE(tp, conftype, member)
|
||||
#define DUMMY_CONF_TEST_MEMBERS , { .INT=NULL }
|
||||
, .var_ptr_dummy=CONF_CHECK_VAR_TYPE(tp, conftype, member)
|
||||
#define DUMMY_CONF_TEST_MEMBERS , .var_ptr_dummy={ .INT=NULL }
|
||||
#define DUMMY_TYPECHECK_INSTANCE(tp) \
|
||||
static tp tp ## _dummy
|
||||
|
||||
|
@ -110,7 +110,8 @@ typedef struct config_var_t {
|
||||
struct_member_t member; /** A struct member corresponding to this
|
||||
* variable. */
|
||||
const char *initvalue; /**< String (or null) describing initial value. */
|
||||
|
||||
uint32_t flags; /**< One or more flags describing special handling for this
|
||||
* variable */
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
/** Used for compiler-magic to typecheck the corresponding field in the
|
||||
* corresponding struct. Only used in unit test mode, at compile-time. */
|
||||
|
@ -52,9 +52,8 @@ static test_struct_t test_struct_t_dummy;
|
||||
CONFIG_VAR_ETYPE(test_struct_t, varname, conftype, member, initvalue)
|
||||
#define V(member,conftype,initvalue) \
|
||||
VAR(#member, conftype, member, initvalue)
|
||||
|
||||
#define OBSOLETE(varname) \
|
||||
{ { .name=varname, .type=CONFIG_TYPE_OBSOLETE }, NULL, {.INT=NULL} }
|
||||
#define OBSOLETE(varname) \
|
||||
CONFIG_VAR_OBSOLETE(varname)
|
||||
|
||||
static config_var_t test_vars[] = {
|
||||
V(s, STRING, "hello"),
|
||||
@ -78,12 +77,11 @@ static config_var_t test_vars[] = {
|
||||
VAR("LineTypeB", LINELIST_S, mixed_lines, NULL),
|
||||
OBSOLETE("obsolete"),
|
||||
{
|
||||
{ .name = "routerset",
|
||||
.type = CONFIG_TYPE_EXTENDED,
|
||||
.type_def = &ROUTERSET_type_defn,
|
||||
.offset = offsetof(test_struct_t, routerset),
|
||||
},
|
||||
NULL, {.INT=NULL}
|
||||
.member = { .name = "routerset",
|
||||
.type = CONFIG_TYPE_EXTENDED,
|
||||
.type_def = &ROUTERSET_type_defn,
|
||||
.offset = offsetof(test_struct_t, routerset),
|
||||
},
|
||||
},
|
||||
VAR("__HiddenInt", POSINT, hidden_int, "0"),
|
||||
VAR("MixedHiddenLines", LINELIST_V, mixed_hidden_lines, NULL),
|
||||
|
Loading…
Reference in New Issue
Block a user