From 4b82076cb381f91c1225eb39efa924e935043d8b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 10 Nov 2019 17:35:28 -0800 Subject: rototiller: setup_from_args() has defaults already I think passing this separately is vestigial from before there was an args struct encapsulating everything. In the future there might be some defaults discretion supported to say use defaults for module settings but not video, or vice versa. So get rid of this pointless parameter in prep for that, just use the args struct. --- src/rototiller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rototiller.c b/src/rototiller.c index fe0c154..92821c2 100644 --- a/src/rototiller.c +++ b/src/rototiller.c @@ -239,7 +239,7 @@ static int setup_module(settings_t *settings, setting_desc_t **next_setting) /* turn args into settings, automatically applying defaults if appropriate, or interactively if appropriate. */ /* returns negative value on error, 0 when settings unchanged from args, 1 when changed */ -static int setup_from_args(argv_t *args, int defaults, setup_t *res_setup) +static int setup_from_args(argv_t *args, setup_t *res_setup) { int r, changes = 0; setup_t setup; @@ -255,7 +255,7 @@ static int setup_from_args(argv_t *args, int defaults, setup_t *res_setup) return -ENOMEM; } - r = setup_interactively(setup.module, setup_module, defaults); + r = setup_interactively(setup.module, setup_module, args->defaults); if (r < 0) { settings_free(setup.module); settings_free(setup.video); @@ -266,7 +266,7 @@ static int setup_from_args(argv_t *args, int defaults, setup_t *res_setup) if (r) changes = 1; - r = setup_interactively(setup.video, setup_video, defaults); + r = setup_interactively(setup.video, setup_video, args->defaults); if (r < 0) { settings_free(setup.module); settings_free(setup.video); @@ -378,7 +378,7 @@ int main(int argc, const char *argv[]) if (args.help) return print_help() < 0 ? EXIT_FAILURE : EXIT_SUCCESS; - exit_if((r = setup_from_args(&args, args.defaults, &setup)) < 0, + exit_if((r = setup_from_args(&args, &setup)) < 0, "unable to setup"); exit_if(r && print_setup_as_args(&setup) < 0, -- cgit v1.2.3