diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-08-30 21:51:17 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-08-30 21:51:17 -0700 |
commit | fa04bbe8d098d503dca6335f695a67fc561f4072 (patch) | |
tree | b6d6b02c0576bb6a0f2d2020c9f7cfdc658e4fe3 | |
parent | 05f922543a9af7b9210c03559e85dd4a777ca549 (diff) |
modules/stars: handle baking errors in stars_setup()
More setup_func conversion to returning the failed setting on
errors during res_setup baking.
-rw-r--r-- | src/modules/stars/stars.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/stars/stars.c b/src/modules/stars/stars.c index ef35c4e..1a66ab3 100644 --- a/src/modules/stars/stars.c +++ b/src/modules/stars/stars.c @@ -271,7 +271,7 @@ til_module_t stars_module = { int stars_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 *rot_adj; + til_setting_t *rot_adj; const char *rot_adj_values[] = { ".0", ".00001", @@ -283,7 +283,7 @@ int stars_setup(const til_settings_t *settings, til_setting_t **res_setting, con }; int r; - r = til_settings_get_and_describe_value(settings, + r = til_settings_get_and_describe_setting(settings, &(til_setting_spec_t){ .name = "Rotation rate", .key = "rot_adj", @@ -305,7 +305,8 @@ int stars_setup(const til_settings_t *settings, til_setting_t **res_setting, con if (!setup) return -ENOMEM; - sscanf(rot_adj, "%f", &setup->rot_adj); + if (sscanf(rot_adj->value, "%f", &setup->rot_adj) != 1) + return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, rot_adj, res_setting, -EINVAL); *res_setup = &setup->til_setup; } |