summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-08-22 17:25:35 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-22 17:25:35 -0400
commit2780cbb9cb9905a7194364d791da4d94ac419998 (patch)
tree76a29e21d60d9cbe83dfa16a64fadbe3fefbc679 /src/test
parentd475d7c2fb3c0ed5120c50011b187f6957a4f52c (diff)
parentc32d485942e766eeea70cab468cc7c727a5be270 (diff)
downloadtor-2780cbb9cb9905a7194364d791da4d94ac419998.tar.gz
tor-2780cbb9cb9905a7194364d791da4d94ac419998.zip
Merge branch 'ticket30935' into ticket30935_merged
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_confparse.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c
index d0c33841fe..ec018f0c52 100644
--- a/src/test/test_confparse.c
+++ b/src/test/test_confparse.c
@@ -49,18 +49,13 @@ typedef struct test_struct_t {
static test_struct_t test_struct_t_dummy;
#define VAR(varname,conftype,member,initvalue) \
- { { .name = varname, \
- .type = CONFIG_TYPE_##conftype, \
- .offset = offsetof(test_struct_t, member), }, \
- initvalue CONF_TEST_MEMBERS(test_struct_t, conftype, member) }
+ CONFIG_VAR_ETYPE(test_struct_t, varname, conftype, member, 0, initvalue)
+#define V(member,conftype,initvalue) \
+ VAR(#member, conftype, member, initvalue)
+#define OBSOLETE(varname) \
+ CONFIG_VAR_OBSOLETE(varname)
-#define V(name,conftype,initvalue) \
- VAR( #name, conftype, name, initvalue )
-
-#define OBSOLETE(varname) \
- { { .name=varname, .type=CONFIG_TYPE_OBSOLETE }, NULL, {.INT=NULL} }
-
-static config_var_t test_vars[] = {
+static const config_var_t test_vars[] = {
V(s, STRING, "hello"),
V(fn, FILENAME, NULL),
V(pos, POSINT, NULL),
@@ -82,12 +77,11 @@ static config_var_t test_vars[] = {
VAR("LineTypeB", LINELIST_S, mixed_lines, NULL),
OBSOLETE("obsolete"),
{
- { .name = "routerset",
- .type = CONFIG_TYPE_ROUTERSET,
- .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),
@@ -129,7 +123,7 @@ static void test_free_cb(void *options);
#define TEST_MAGIC 0x1337
-static config_format_t test_fmt = {
+static const config_format_t test_fmt = {
sizeof(test_struct_t),
{
"test_struct_t",