mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
Use named-member syntax for initializing config_format_t objects
I'm about to mess with their lists of callbacks, and I don't want to proliferate lists where we say "NULL, NULL, NULL, ..."
This commit is contained in:
parent
68e1ced607
commit
27dbf20bf4
@ -864,19 +864,18 @@ static void options_clear_cb(const config_mgr_t *mgr, void *opts);
|
|||||||
|
|
||||||
/** Configuration format for or_options_t. */
|
/** Configuration format for or_options_t. */
|
||||||
static const config_format_t options_format = {
|
static const config_format_t options_format = {
|
||||||
sizeof(or_options_t),
|
.size = sizeof(or_options_t),
|
||||||
{
|
.magic = {
|
||||||
"or_options_t",
|
"or_options_t",
|
||||||
OR_OPTIONS_MAGIC,
|
OR_OPTIONS_MAGIC,
|
||||||
offsetof(or_options_t, magic_),
|
offsetof(or_options_t, magic_),
|
||||||
},
|
},
|
||||||
option_abbrevs_,
|
.abbrevs = option_abbrevs_,
|
||||||
option_deprecation_notes_,
|
.deprecations = option_deprecation_notes_,
|
||||||
option_vars_,
|
.vars = option_vars_,
|
||||||
options_validate_cb,
|
.validate_fn = options_validate_cb,
|
||||||
options_clear_cb,
|
.clear_fn = options_clear_cb,
|
||||||
NULL,
|
.config_suite_offset = offsetof(or_options_t, subconfigs_),
|
||||||
offsetof(or_options_t, subconfigs_),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -157,19 +157,17 @@ static struct_member_t state_extra_var = {
|
|||||||
|
|
||||||
/** Configuration format for or_state_t. */
|
/** Configuration format for or_state_t. */
|
||||||
static const config_format_t state_format = {
|
static const config_format_t state_format = {
|
||||||
sizeof(or_state_t),
|
.size = sizeof(or_state_t),
|
||||||
{
|
.magic = {
|
||||||
"or_state_t",
|
"or_state_t",
|
||||||
OR_STATE_MAGIC,
|
OR_STATE_MAGIC,
|
||||||
offsetof(or_state_t, magic_),
|
offsetof(or_state_t, magic_),
|
||||||
},
|
},
|
||||||
state_abbrevs_,
|
.abbrevs = state_abbrevs_,
|
||||||
NULL,
|
.vars = state_vars_,
|
||||||
state_vars_,
|
.validate_fn = or_state_validate_cb,
|
||||||
or_state_validate_cb,
|
.extra = &state_extra_var,
|
||||||
NULL,
|
.config_suite_offset = offsetof(or_state_t, substates_),
|
||||||
&state_extra_var,
|
|
||||||
offsetof(or_state_t, substates_),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* A global configuration manager for state-file objects */
|
/* A global configuration manager for state-file objects */
|
||||||
|
@ -87,19 +87,16 @@ static const struct_member_t state_extra_var = {
|
|||||||
|
|
||||||
/** Configuration format of sr_disk_state_t. */
|
/** Configuration format of sr_disk_state_t. */
|
||||||
static const config_format_t state_format = {
|
static const config_format_t state_format = {
|
||||||
sizeof(sr_disk_state_t),
|
.size = sizeof(sr_disk_state_t),
|
||||||
{
|
.magic = {
|
||||||
"sr_disk_state_t",
|
"sr_disk_state_t",
|
||||||
SR_DISK_STATE_MAGIC,
|
SR_DISK_STATE_MAGIC,
|
||||||
offsetof(sr_disk_state_t, magic_),
|
offsetof(sr_disk_state_t, magic_),
|
||||||
},
|
},
|
||||||
NULL,
|
.vars = state_vars,
|
||||||
NULL,
|
.validate_fn = disk_state_validate_cb,
|
||||||
state_vars,
|
.extra = &state_extra_var,
|
||||||
disk_state_validate_cb,
|
.config_suite_offset = -1,
|
||||||
NULL,
|
|
||||||
&state_extra_var,
|
|
||||||
-1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Global configuration manager for the shared-random state file */
|
/** Global configuration manager for the shared-random state file */
|
||||||
|
@ -119,19 +119,17 @@ test_validate_cb(const void *old_options, void *options, char **msg)
|
|||||||
#define TEST_MAGIC 0x1337
|
#define TEST_MAGIC 0x1337
|
||||||
|
|
||||||
static const config_format_t test_fmt = {
|
static const config_format_t test_fmt = {
|
||||||
sizeof(test_struct_t),
|
.size = sizeof(test_struct_t),
|
||||||
{
|
.magic = {
|
||||||
"test_struct_t",
|
"test_struct_t",
|
||||||
TEST_MAGIC,
|
TEST_MAGIC,
|
||||||
offsetof(test_struct_t, magic),
|
offsetof(test_struct_t, magic),
|
||||||
},
|
},
|
||||||
test_abbrevs,
|
.abbrevs = test_abbrevs,
|
||||||
test_deprecation_notes,
|
.deprecations = test_deprecation_notes,
|
||||||
test_vars,
|
.vars = test_vars,
|
||||||
test_validate_cb,
|
.validate_fn = test_validate_cb,
|
||||||
NULL,
|
.config_suite_offset = -1,
|
||||||
NULL,
|
|
||||||
-1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Make sure that config_init sets everything to the right defaults. */
|
/* Make sure that config_init sets everything to the right defaults. */
|
||||||
@ -815,19 +813,18 @@ static struct_member_t extra = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static config_format_t etest_fmt = {
|
static config_format_t etest_fmt = {
|
||||||
sizeof(test_struct_t),
|
.size = sizeof(test_struct_t),
|
||||||
{
|
.magic = {
|
||||||
"test_struct_t (with extra lines)",
|
"test_struct_t (with extra lines)",
|
||||||
ETEST_MAGIC,
|
ETEST_MAGIC,
|
||||||
offsetof(test_struct_t, magic),
|
offsetof(test_struct_t, magic),
|
||||||
},
|
},
|
||||||
test_abbrevs,
|
.abbrevs = test_abbrevs,
|
||||||
test_deprecation_notes,
|
.deprecations = test_deprecation_notes,
|
||||||
test_vars,
|
.vars = test_vars,
|
||||||
test_validate_cb,
|
.validate_fn = test_validate_cb,
|
||||||
NULL,
|
.extra = &extra,
|
||||||
&extra,
|
.config_suite_offset = -1,
|
||||||
-1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Try out the feature where we can store unrecognized lines and dump them
|
/* Try out the feature where we can store unrecognized lines and dump them
|
||||||
|
Loading…
Reference in New Issue
Block a user