diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-23 14:39:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-24 20:30:32 -0400 |
commit | 4a248bafba0136ded8370de672c0b27b912bbede (patch) | |
tree | f1db4023fe626d3f946890d06777d073599add86 | |
parent | 24ee44df90d12eb98ba5a39638963696ce2f8012 (diff) | |
download | tor-4a248bafba0136ded8370de672c0b27b912bbede.tar.gz tor-4a248bafba0136ded8370de672c0b27b912bbede.zip |
Rename validate_fn{,_t} to start with "legacy_".
The current API of this callback mixes responsibilities, including:
* validation
* transition checking
* processing (modifying) the configuration object.
These will have to be disentangled piece by piece, so for now, we'll
have "legacy" validate functions as well.
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \
validate_fn_t legacy_validate_fn_t \
validate_fn legacy_validate_fn
-rw-r--r-- | src/app/config/config.c | 2 | ||||
-rw-r--r-- | src/app/config/statefile.c | 2 | ||||
-rw-r--r-- | src/feature/dirauth/shared_random_state.c | 2 | ||||
-rw-r--r-- | src/lib/confmgt/confparse.c | 2 | ||||
-rw-r--r-- | src/lib/confmgt/confparse.h | 4 | ||||
-rw-r--r-- | src/test/test_confparse.c | 4 |
6 files changed, 8 insertions, 8 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index aafc8c5a7f..4e7720b0b3 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -873,7 +873,7 @@ static const config_format_t options_format = { .abbrevs = option_abbrevs_, .deprecations = option_deprecation_notes_, .vars = option_vars_, - .validate_fn = options_validate_cb, + .legacy_validate_fn = options_validate_cb, .clear_fn = options_clear_cb, .config_suite_offset = offsetof(or_options_t, subconfigs_), }; diff --git a/src/app/config/statefile.c b/src/app/config/statefile.c index 2e5edc41c9..e277e722cd 100644 --- a/src/app/config/statefile.c +++ b/src/app/config/statefile.c @@ -165,7 +165,7 @@ static const config_format_t state_format = { }, .abbrevs = state_abbrevs_, .vars = state_vars_, - .validate_fn = or_state_validate_cb, + .legacy_validate_fn = or_state_validate_cb, .extra = &state_extra_var, .config_suite_offset = offsetof(or_state_t, substates_), }; diff --git a/src/feature/dirauth/shared_random_state.c b/src/feature/dirauth/shared_random_state.c index 2070e03aa1..eeb005d477 100644 --- a/src/feature/dirauth/shared_random_state.c +++ b/src/feature/dirauth/shared_random_state.c @@ -94,7 +94,7 @@ static const config_format_t state_format = { offsetof(sr_disk_state_t, magic_), }, .vars = state_vars, - .validate_fn = disk_state_validate_cb, + .legacy_validate_fn = disk_state_validate_cb, .extra = &state_extra_var, .config_suite_offset = -1, }; diff --git a/src/lib/confmgt/confparse.c b/src/lib/confmgt/confparse.c index 323c88a31c..96eba610bb 100644 --- a/src/lib/confmgt/confparse.c +++ b/src/lib/confmgt/confparse.c @@ -1166,7 +1166,7 @@ config_dump(const config_mgr_t *mgr, const void *default_options, /* XXX use a 1 here so we don't add a new log line while dumping */ if (default_options == NULL) { - if (fmt->validate_fn(NULL, defaults_tmp, &msg) < 0) { + if (fmt->legacy_validate_fn(NULL, defaults_tmp, &msg) < 0) { // LCOV_EXCL_START log_err(LD_BUG, "Failed to validate default config: %s", msg); tor_free(msg); diff --git a/src/lib/confmgt/confparse.h b/src/lib/confmgt/confparse.h index 8d7278cb04..d50d6d8143 100644 --- a/src/lib/confmgt/confparse.h +++ b/src/lib/confmgt/confparse.h @@ -68,7 +68,7 @@ typedef struct config_deprecation_t { * config_dump(); later in our refactoring, it will be cleaned up and used * more generally. */ -typedef int (*validate_fn_t)(const void *oldval, +typedef int (*legacy_validate_fn_t)(const void *oldval, void *newval, char **msg_out); @@ -98,7 +98,7 @@ typedef struct config_format_t { const config_var_t *vars; /**< List of variables we recognize, their default * values, and where we stick them in the * structure. */ - validate_fn_t validate_fn; /**< Function to validate config. */ + legacy_validate_fn_t legacy_validate_fn; /**< Function to validate config. */ clear_cfg_fn_t clear_fn; /**< Function to clear the configuration. */ /** If present, extra denotes a LINELIST variable for unrecognized * lines. Otherwise, unrecognized lines are an error. */ diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c index 8cda96ba57..0c12e35f8a 100644 --- a/src/test/test_confparse.c +++ b/src/test/test_confparse.c @@ -128,7 +128,7 @@ static const config_format_t test_fmt = { .abbrevs = test_abbrevs, .deprecations = test_deprecation_notes, .vars = test_vars, - .validate_fn = test_validate_cb, + .legacy_validate_fn = test_validate_cb, .config_suite_offset = -1, }; @@ -822,7 +822,7 @@ static config_format_t etest_fmt = { .abbrevs = test_abbrevs, .deprecations = test_deprecation_notes, .vars = test_vars, - .validate_fn = test_validate_cb, + .legacy_validate_fn = test_validate_cb, .extra = &extra, .config_suite_offset = -1, }; |