mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Extend macros to allow flag arguments.
This commit is contained in:
parent
5b252d31ed
commit
b6457d4c08
@ -259,11 +259,11 @@ DUMMY_TYPECHECK_INSTANCE(or_options_t);
|
|||||||
* or_options_t.<b>member</b>"
|
* or_options_t.<b>member</b>"
|
||||||
*/
|
*/
|
||||||
#define VAR(varname,conftype,member,initvalue) \
|
#define VAR(varname,conftype,member,initvalue) \
|
||||||
CONFIG_VAR_ETYPE(or_options_t, varname, conftype, member, initvalue)
|
CONFIG_VAR_ETYPE(or_options_t, varname, conftype, member, 0, initvalue)
|
||||||
|
|
||||||
/* As VAR, but uses a type definition in addition to a type enum. */
|
/* As VAR, but uses a type definition in addition to a type enum. */
|
||||||
#define VAR_D(varname,conftype,member,initvalue) \
|
#define VAR_D(varname,conftype,member,initvalue) \
|
||||||
CONFIG_VAR_DEFN(or_options_t, varname, conftype, member, initvalue)
|
CONFIG_VAR_DEFN(or_options_t, varname, conftype, member, 0, initvalue)
|
||||||
|
|
||||||
#define V(member,conftype,initvalue) \
|
#define V(member,conftype,initvalue) \
|
||||||
VAR(#member, conftype, member, initvalue)
|
VAR(#member, conftype, member, initvalue)
|
||||||
|
@ -71,7 +71,7 @@ static config_abbrev_t state_abbrevs_[] = {
|
|||||||
DUMMY_TYPECHECK_INSTANCE(or_state_t);
|
DUMMY_TYPECHECK_INSTANCE(or_state_t);
|
||||||
|
|
||||||
#define VAR(varname,conftype,member,initvalue) \
|
#define VAR(varname,conftype,member,initvalue) \
|
||||||
CONFIG_VAR_ETYPE(or_state_t, varname, conftype, member, initvalue)
|
CONFIG_VAR_ETYPE(or_state_t, varname, conftype, member, 0, initvalue)
|
||||||
#define V(member,conftype,initvalue) \
|
#define V(member,conftype,initvalue) \
|
||||||
VAR(#member, conftype, member, initvalue)
|
VAR(#member, conftype, member, initvalue)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ static const char dstate_cur_srv_key[] = "SharedRandCurrentValue";
|
|||||||
DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
|
DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
|
||||||
|
|
||||||
#define VAR(varname,conftype,member,initvalue) \
|
#define VAR(varname,conftype,member,initvalue) \
|
||||||
CONFIG_VAR_ETYPE(sr_disk_state_t, varname, conftype, member, initvalue)
|
CONFIG_VAR_ETYPE(sr_disk_state_t, varname, conftype, member, 0, initvalue)
|
||||||
#define V(member,conftype,initvalue) \
|
#define V(member,conftype,initvalue) \
|
||||||
VAR(#member, conftype, member, initvalue)
|
VAR(#member, conftype, member, initvalue)
|
||||||
|
|
||||||
|
@ -30,12 +30,14 @@
|
|||||||
* Most modules that use this macro should wrap it in a local macro that
|
* Most modules that use this macro should wrap it in a local macro that
|
||||||
* sets structtype to the local configuration type.
|
* sets structtype to the local configuration type.
|
||||||
**/
|
**/
|
||||||
#define CONFIG_VAR_ETYPE(structtype, varname, vartype, membername, initval) \
|
#define CONFIG_VAR_ETYPE(structtype, varname, vartype, membername, \
|
||||||
|
varflags, initval) \
|
||||||
{ .member = \
|
{ .member = \
|
||||||
{ .name = varname, \
|
{ .name = varname, \
|
||||||
.type = CONFIG_TYPE_ ## vartype, \
|
.type = CONFIG_TYPE_ ## vartype, \
|
||||||
.offset = offsetof(structtype, membername), \
|
.offset = offsetof(structtype, membername), \
|
||||||
}, \
|
}, \
|
||||||
|
.flags = varflags, \
|
||||||
.initvalue = initval \
|
.initvalue = initval \
|
||||||
CONF_TEST_MEMBERS(structtype, vartype, membername) \
|
CONF_TEST_MEMBERS(structtype, vartype, membername) \
|
||||||
}
|
}
|
||||||
@ -44,13 +46,15 @@
|
|||||||
* As CONFIG_VAR_XTYPE, but declares a value using an extension type whose
|
* As CONFIG_VAR_XTYPE, but declares a value using an extension type whose
|
||||||
* type definition is <b>vartype</b>_type_defn.
|
* type definition is <b>vartype</b>_type_defn.
|
||||||
**/
|
**/
|
||||||
#define CONFIG_VAR_DEFN(structtype, varname, vartype, membername, initval) \
|
#define CONFIG_VAR_DEFN(structtype, varname, vartype, membername, \
|
||||||
|
varflags, initval) \
|
||||||
{ .member = \
|
{ .member = \
|
||||||
{ .name = varname, \
|
{ .name = varname, \
|
||||||
.type = CONFIG_TYPE_EXTENDED, \
|
.type = CONFIG_TYPE_EXTENDED, \
|
||||||
.type_def = &vartype ## _type_defn, \
|
.type_def = &vartype ## _type_defn, \
|
||||||
.offset = offsetof(structtype, membername), \
|
.offset = offsetof(structtype, membername), \
|
||||||
}, \
|
}, \
|
||||||
|
.flags = varflags, \
|
||||||
.initvalue = initval \
|
.initvalue = initval \
|
||||||
CONF_TEST_MEMBERS(structtype, vartype, membername) \
|
CONF_TEST_MEMBERS(structtype, vartype, membername) \
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ typedef struct test_struct_t {
|
|||||||
static test_struct_t test_struct_t_dummy;
|
static test_struct_t test_struct_t_dummy;
|
||||||
|
|
||||||
#define VAR(varname,conftype,member,initvalue) \
|
#define VAR(varname,conftype,member,initvalue) \
|
||||||
CONFIG_VAR_ETYPE(test_struct_t, varname, conftype, member, initvalue)
|
CONFIG_VAR_ETYPE(test_struct_t, varname, conftype, member, 0, initvalue)
|
||||||
#define V(member,conftype,initvalue) \
|
#define V(member,conftype,initvalue) \
|
||||||
VAR(#member, conftype, member, initvalue)
|
VAR(#member, conftype, member, initvalue)
|
||||||
#define OBSOLETE(varname) \
|
#define OBSOLETE(varname) \
|
||||||
|
Loading…
Reference in New Issue
Block a user