aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_confparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-07-23 12:04:59 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-28 09:40:53 -0400
commit47654d32497acae23aafbe3316ae73d3c00429c8 (patch)
tree9d9bb68efe2587b033eef4de945c4d887b2cfd76 /src/test/test_confparse.c
parent3d1f9f583a45143c1259b8926f8c57fa57fc1efb (diff)
downloadtor-47654d32497acae23aafbe3316ae73d3c00429c8.tar.gz
tor-47654d32497acae23aafbe3316ae73d3c00429c8.zip
Refactor config free logic to use a single path.
The right way to free a config object is now to wrap config_free(), always. Instead of creating an alternative free function, objects should provide an alternative clear callback to free any fields that the configuration manager doesn't manage. This lets us simplify our code a little, and lets us extend the confparse.c code to manage additional fields in config_free.
Diffstat (limited to 'src/test/test_confparse.c')
-rw-r--r--src/test/test_confparse.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c
index 78eb3d38bf..273232fe5d 100644
--- a/src/test/test_confparse.c
+++ b/src/test/test_confparse.c
@@ -119,8 +119,6 @@ test_validate_cb(void *old_options, void *options, void *default_options,
return 0;
}
-static void test_free_cb(const config_mgr_t *mgr, void *options);
-
#define TEST_MAGIC 0x1337
static const config_format_t test_fmt = {
@@ -134,19 +132,10 @@ static const config_format_t test_fmt = {
test_deprecation_notes,
test_vars,
test_validate_cb,
- test_free_cb,
+ NULL,
NULL,
};
-static void
-test_free_cb(const config_mgr_t *mgr, void *options)
-{
- if (!options)
- return;
-
- config_free(mgr, options);
-}
-
/* Make sure that config_init sets everything to the right defaults. */
static void
test_confparse_init(void *arg)
@@ -824,7 +813,7 @@ static config_format_t etest_fmt = {
test_deprecation_notes,
test_vars,
test_validate_cb,
- test_free_cb,
+ NULL,
&extra,
};