summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-10-02 23:15:44 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-10-02 23:15:44 -0700
commitc834a26416fc1a2d5b4c9e94e0bd2788020af3f2 (patch)
tree07941f4a1573d02f41dd32e79f15ba4a7aebb1a0 /src
parent696f28e5296c3b39eac56eed4d20560bf06cba38 (diff)
modules/checkers: adopt til_value_to_pos() helper
Mechanical transition from checkers_value_to_pos() to the now libtil-provided equivalent of identical implementation.
Diffstat (limited to 'src')
-rw-r--r--src/modules/checkers/checkers.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c
index 43f4e1f..2a61559 100644
--- a/src/modules/checkers/checkers.c
+++ b/src/modules/checkers/checkers.c
@@ -571,20 +571,6 @@ static void checkers_setup_free(til_setup_t *setup)
}
-/* TODO: move something like this to libtil */
-static int checkers_value_to_pos(const char **options, const char *value, unsigned *res_pos)
-{
- for (unsigned i = 0; options[i]; i++) {
- if (!strcasecmp(value, options[i])) {
- *res_pos = i;
- return 0;
- }
- }
-
- return -ENOENT;
-}
-
-
static int checkers_fill_module_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup)
{
/* XXX: Note that this is for processing the underlying fill_module_settings, starting with the module name.
@@ -889,7 +875,7 @@ static int checkers_setup(const til_settings_t *settings, til_setting_t **res_se
return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, dynamics_rate, res_setting, -EINVAL);
}
- r = checkers_value_to_pos(fill_values, fill->value, (unsigned *)&setup->fill);
+ r = til_value_to_pos(fill_values, fill->value, (unsigned *)&setup->fill);
if (r < 0)
return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, fill, res_setting, -EINVAL);
@@ -897,7 +883,7 @@ static int checkers_setup(const til_settings_t *settings, til_setting_t **res_se
if (r < 0)
return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, fill_color, res_setting, -EINVAL);
- r = checkers_value_to_pos(clear_values, clear->value, (unsigned *)&setup->clear);
+ r = til_value_to_pos(clear_values, clear->value, (unsigned *)&setup->clear);
if (r < 0)
return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, clear, res_setting, -EINVAL);
© All Rights Reserved