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
This commit is contained in:
Nick Mathewson 2019-10-23 14:39:20 -04:00
parent 24ee44df90
commit 4a248bafba
6 changed files with 8 additions and 8 deletions

View File

@ -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_),
};

View File

@ -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_),
};

View File

@ -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,
};

View File

@ -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);

View File

@ -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. */

View File

@ -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,
};