From 3b43a50c3582f8f9bcd914ac886a94502b868657 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 30 May 2023 14:12:23 -0700 Subject: modules/*: utilize til_module_setup_finalize() This replaces the few ad-hoc til_module_t.setup() setup-baking callers with the new til_module_setup_finalize() which always produces a til_setup_t having an appropriate path, even when there is no til_module_t.setup() method. --- src/modules/checkers/checkers.c | 10 ++++------ src/modules/compose/compose.c | 21 ++++++++------------- src/modules/rtv/rtv.c | 12 +++++------- 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index 3bd4dda..be83f9e 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -692,12 +692,10 @@ static int checkers_setup(const til_settings_t *settings, til_setting_t **res_se return -ENOMEM; } - if (setup->fill_module->setup) { - r = setup->fill_module->setup(fill_module_settings, res_setting, res_desc, &setup->fill_module_setup); - if (r) { - til_setup_free(&setup->til_setup); - return r; - } + r = til_module_setup_finalize(setup->fill_module, fill_module_settings, &setup->fill_module_setup); + if (r < 0) { + til_setup_free(&setup->til_setup); + return r; } } diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index 4f0a8c8..78a5fe1 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -477,13 +477,11 @@ static int compose_setup(const til_settings_t *settings, til_setting_t **res_set return -ENOMEM; } - if (layer_module->setup) { - r = layer_module->setup(layer_setting->value_as_nested_settings, res_setting, res_desc, &setup->layers[i].setup); - if (r < 0) { - til_setup_free(&setup->til_setup); + r = til_module_setup_finalize(layer_module, layer_setting->value_as_nested_settings, &setup->layers[i].setup); + if (r < 0) { + til_setup_free(&setup->til_setup); - return r; - } + return r; } } @@ -504,14 +502,11 @@ static int compose_setup(const til_settings_t *settings, til_setting_t **res_set return -ENOMEM; } - if (texture_module->setup) { - /* bake the texture settings */ - r = texture_module->setup(texture_settings, res_setting, res_desc, &setup->texture.setup); - if (r < 0) { - til_setup_free(&setup->til_setup); + r = til_module_setup_finalize(texture_module, texture_settings, &setup->texture.setup); + if (r < 0) { + til_setup_free(&setup->til_setup); - return r; - } + return r; } } diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 389a0f5..a2bc3c9 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -560,14 +560,12 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting return -ENOMEM; } - if (snow_module->setup) { - /* bake the snow_module settings */ - r = snow_module->setup(snow_module_settings, res_setting, res_desc, &setup->snow_module_setup); - if (r < 0) { - til_setup_free(&setup->til_setup); + /* bake the snow_module settings */ + r = til_module_setup_finalize(snow_module, snow_module_settings, &setup->snow_module_setup); + if (r < 0) { + til_setup_free(&setup->til_setup); - return r; - } + return r; } } -- cgit v1.2.3