aboutsummaryrefslogtreecommitdiff
path: root/src/app/config/statefile.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/app/config/statefile.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/app/config/statefile.c')
-rw-r--r--src/app/config/statefile.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c
index 54ee398a7f..ede35e6ced 100644
--- a/src/app/config/statefile.c
+++ b/src/app/config/statefile.c
@@ -145,8 +145,6 @@ static int or_state_validate_cb(void *old_options, void *options,
void *default_options,
int from_setconf, char **msg);
-static void or_state_free_cb(const config_mgr_t *mgr, void *state);
-
/** Magic value for or_state_t. */
#define OR_STATE_MAGIC 0x57A73f57
@@ -170,7 +168,7 @@ static const config_format_t state_format = {
NULL,
state_vars_,
or_state_validate_cb,
- or_state_free_cb,
+ NULL,
&state_extra_var,
};
@@ -282,13 +280,6 @@ or_state_validate_cb(void *old_state, void *state, void *default_state,
return or_state_validate(state, msg);
}
-static void
-or_state_free_cb(const config_mgr_t *mgr, void *state)
-{
- (void)mgr;
- or_state_free_(state);
-}
-
/** Return 0 if every setting in <b>state</b> is reasonable, and a
* permissible transition from <b>old_state</b>. Else warn and return -1.
* Should have no side effects, except for normalizing the contents of