summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-30 21:00:31 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-30 21:45:13 -0700
commit81b1fb8bf15425293f588346cab401416a7f754c (patch)
tree2aa3b4f8f0d396b09f69d80fb9cece7bd0a7dfcc /src/modules
parentcc91cfb9a58a00011166ef0f46e7b23310ea6eb3 (diff)
modules/moire: handle baking errors in moire_setup()
More setup_func conversion to returning the failed setting on errors during res_setup baking.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/moire/moire.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/moire/moire.c b/src/modules/moire/moire.c
index 9924a10..aebd897 100644
--- a/src/modules/moire/moire.c
+++ b/src/modules/moire/moire.c
@@ -130,7 +130,7 @@ til_module_t moire_module = {
static int moire_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup)
{
- const char *centers;
+ til_setting_t *centers;
const char *values[] = {
"2",
"3",
@@ -140,7 +140,7 @@ static int moire_setup(const til_settings_t *settings, til_setting_t **res_setti
};
int r;
- r = til_settings_get_and_describe_value(settings,
+ r = til_settings_get_and_describe_setting(settings,
&(til_setting_spec_t){
.name = "Number of radial centers",
.key = "centers",
@@ -162,7 +162,8 @@ static int moire_setup(const til_settings_t *settings, til_setting_t **res_setti
if (!setup)
return -ENOMEM;
- sscanf(centers, "%u", &setup->n_centers);
+ if (sscanf(centers->value, "%u", &setup->n_centers) != 1)
+ return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, centers, res_setting, -EINVAL);
*res_setup = &setup->til_setup;
}
© All Rights Reserved