validate_fn(): remove now-unused defaults and from_setconf.

These arguments were only used by options_validate, and are now
ignored even there.
This commit is contained in:
Nick Mathewson 2019-10-22 13:52:40 -04:00
parent 91413e04b4
commit 697d99e504
6 changed files with 10 additions and 26 deletions

View File

@ -844,8 +844,7 @@ static int parse_outbound_addresses(or_options_t *options, int validate_only,
static void config_maybe_load_geoip_files_(const or_options_t *options,
const or_options_t *old_options);
static int options_validate_cb(void *old_options, void *options,
void *default_options,
int from_setconf, char **msg);
char **msg);
static void cleanup_protocol_warning_severity_level(void);
static void set_protocol_warning_severity_level(int warning_severity);
static void options_clear_cb(const config_mgr_t *mgr, void *opts);
@ -3231,12 +3230,10 @@ compute_publishserverdescriptor(or_options_t *options)
#define RECOMMENDED_MIN_CIRCUIT_BUILD_TIMEOUT (10)
static int
options_validate_cb(void *old_options, void *options, void *default_options,
int from_setconf, char **msg)
options_validate_cb(void *old_options, void *options, char **msg)
{
in_option_validation = 1;
int rv = options_validate(old_options, options, default_options,
from_setconf, msg);
int rv = options_validate(old_options, options, NULL, 0, msg);
in_option_validation = 0;
return rv;
}

View File

@ -141,9 +141,8 @@ static const config_var_t state_vars_[] = {
static int or_state_validate(or_state_t *state, char **msg);
static int or_state_validate_cb(void *old_options, void *options,
void *default_options,
int from_setconf, char **msg);
static int or_state_validate_cb(void *old_options,
void *options, char **msg);
/** Magic value for or_state_t. */
#define OR_STATE_MAGIC 0x57A73f57
@ -269,13 +268,10 @@ validate_transports_in_state(or_state_t *state)
}
static int
or_state_validate_cb(void *old_state, void *state, void *default_state,
int from_setconf, char **msg)
or_state_validate_cb(void *old_state, void *state, char **msg)
{
/* We don't use these; only options do. Still, we need to match that
* signature. */
(void) from_setconf;
(void) default_state;
(void) old_state;
return or_state_validate(state, msg);

View File

@ -60,8 +60,7 @@ DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
#define SR_DISK_STATE_MAGIC 0x98AB1254
static int
disk_state_validate_cb(void *old_state, void *state, void *default_state,
int from_setconf, char **msg);
disk_state_validate_cb(void *old_state, void *state, char **msg);
/** Array of variables that are saved to disk as a persistent state. */
static const config_var_t state_vars[] = {
@ -345,12 +344,9 @@ disk_state_validate(const sr_disk_state_t *state)
/** Validate the disk state (NOP for now). */
static int
disk_state_validate_cb(void *old_state, void *state, void *default_state,
int from_setconf, char **msg)
disk_state_validate_cb(void *old_state, void *state, char **msg)
{
/* We don't use these; only options do. */
(void) from_setconf;
(void) default_state;
(void) old_state;
/* This is called by config_dump which is just before we are about to

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, defaults_tmp, 1, &msg) < 0) {
if (fmt->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

@ -70,8 +70,6 @@ typedef struct config_deprecation_t {
*/
typedef int (*validate_fn_t)(void *oldval,
void *newval,
void *default_val,
int from_setconf,
char **msg_out);
struct config_mgr_t;

View File

@ -103,12 +103,9 @@ static config_deprecation_t test_deprecation_notes[] = {
};
static int
test_validate_cb(void *old_options, void *options, void *default_options,
int from_setconf, char **msg)
test_validate_cb(void *old_options, void *options, char **msg)
{
(void)old_options;
(void)default_options;
(void)from_setconf;
(void)msg;
test_struct_t *ts = options;