summaryrefslogtreecommitdiff
path: root/src/rototiller.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-10 17:35:28 -0800
committerVito Caputo <vcaputo@pengaru.com>2019-11-10 17:35:28 -0800
commit4b82076cb381f91c1225eb39efa924e935043d8b (patch)
treea43474cc60f7281037beca1e238635be216ca038 /src/rototiller.c
parente5101cfb48609cea230f2b900929bd27623854d8 (diff)
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.
Diffstat (limited to 'src/rototiller.c')
-rw-r--r--src/rototiller.c8
1 files 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,
© All Rights Reserved