Use coccinelle to fix most options_validate() call sites.

There was one that it could not find because it was in a macro definition.

I used the following semantic patch:

@@
expression e1, e2, e3, e4, e5;
@@
 options_validate(e1,
 e2,
- e3,
- e4,
 e5)
This commit is contained in:
Nick Mathewson 2019-10-22 14:01:42 -04:00
parent 8a27023d21
commit 41e6e2f496
3 changed files with 258 additions and 259 deletions

View File

@ -2681,7 +2681,7 @@ options_trial_assign(config_line_t *list, unsigned flags, char **msg)
in_option_validation = 1;
if (options_validate(cur_options, trial_options,
global_default_options, 1, msg) < 0) {
msg) < 0) {
or_options_free(trial_options);
rv = SETOPT_ERR_PARSE; /*XXX make this a separate return value. */
goto done;
@ -3233,7 +3233,7 @@ static int
options_validate_cb(void *old_options, void *options, char **msg)
{
in_option_validation = 1;
int rv = options_validate(old_options, options, NULL, 0, msg);
int rv = options_validate(old_options, options, msg);
in_option_validation = 0;
return rv;
}
@ -5515,8 +5515,7 @@ options_init_from_string(const char *cf_defaults, const char *cf,
newoptions->FilesOpenedByIncludes = opened_files;
/* Validate newoptions */
if (options_validate(oldoptions, newoptions, newdefaultoptions,
0, msg) < 0) {
if (options_validate(oldoptions, newoptions, msg) < 0) {
err = SETOPT_ERR_PARSE; /*XXX make this a separate return value.*/
goto err;
}

View File

@ -913,7 +913,7 @@ test_config_fix_my_family(void *arg)
options_init(defaults);
options->MyFamily_lines = family;
options_validate(NULL, options, defaults, 0, &err) ;
options_validate(NULL, options, &err) ;
if (err != NULL) {
TT_FAIL(("options_validate failed: %s", err));
@ -5649,7 +5649,7 @@ test_config_check_bridge_distribution_setting_not_a_bridge(void *arg)
options->BridgeRelay = 0;
options->BridgeDistribution = (char*)("https");
ret = options_validate(old_options, options, default_options, 0, &message);
ret = options_validate(old_options, options, &message);
tt_int_op(ret, OP_EQ, -1);
tt_str_op(message, OP_EQ, "You set BridgeDistribution, but you "

File diff suppressed because it is too large Load Diff