diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-05-25 13:15:00 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-05-25 13:15:00 -0700 |
commit | 9b6136a732114949be57d42ce358f7b3cc2f5bbf (patch) | |
tree | 151634aa9577dc9838ac7516dfa8e54b91c2be68 | |
parent | 3e3faa57e22610fa03050089b0e15c9df7fe832e (diff) |
*: normalize on all case-insensitive comparisons
I don't think rototiller is an appropriate place for being so
uncooperative, if someone gets the case wrong anywhere just make
it work. We should avoid making different things so subtly
different that case alone is the distinction anyways, so I don't
see this creating any future namespace collision problems.
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/modules/checkers/checkers.c | 12 | ||||
-rw-r--r-- | src/modules/compose/compose.c | 4 | ||||
-rw-r--r-- | src/modules/rtv/rtv.c | 10 | ||||
-rw-r--r-- | src/modules/shapes/shapes.c | 2 | ||||
-rw-r--r-- | src/modules/swarm/swarm.c | 2 | ||||
-rw-r--r-- | src/setup.c | 2 | ||||
-rw-r--r-- | src/til_args.c | 8 | ||||
-rw-r--r-- | src/til_settings.c | 2 |
9 files changed, 23 insertions, 23 deletions
@@ -100,14 +100,14 @@ static int setup_video(til_settings_t *settings, til_setting_t **res_setting, co /* XXX: this is kind of hacky for now */ #ifdef HAVE_DRM - if (!strcmp(video, "drm")) { + if (!strcasecmp(video, "drm")) { fb_ops = &drm_fb_ops; return drm_fb_ops.setup(settings, res_setting, res_desc, res_setup); } #endif #ifdef HAVE_SDL - if (!strcmp(video, "sdl")) { + if (!strcasecmp(video, "sdl")) { fb_ops = &sdl_fb_ops; return sdl_fb_ops.setup(settings, res_setting, res_desc, res_setup); diff --git a/src/modules/checkers/checkers.c b/src/modules/checkers/checkers.c index 56037fa..e911089 100644 --- a/src/modules/checkers/checkers.c +++ b/src/modules/checkers/checkers.c @@ -259,22 +259,22 @@ static int checkers_setup(const til_settings_t *settings, til_setting_t **res_se sscanf(size, "%u", &setup->size); - if (!strcmp(pattern, "checkered")) + if (!strcasecmp(pattern, "checkered")) setup->pattern = CHECKERS_PATTERN_CHECKERED; - else if (!strcmp(pattern, "random")) + else if (!strcasecmp(pattern, "random")) setup->pattern = CHECKERS_PATTERN_RANDOM; else { free(setup); return -EINVAL; } - if (!strcmp(dynamics, "odd")) + if (!strcasecmp(dynamics, "odd")) setup->dynamics = CHECKERS_DYNAMICS_ODD; - else if (!strcmp(dynamics, "even")) + else if (!strcasecmp(dynamics, "even")) setup->dynamics = CHECKERS_DYNAMICS_EVEN; - else if (!strcmp(dynamics, "alternating")) + else if (!strcasecmp(dynamics, "alternating")) setup->dynamics = CHECKERS_DYNAMICS_ALTERNATING; - else if (!strcmp(dynamics, "random")) + else if (!strcasecmp(dynamics, "random")) setup->dynamics = CHECKERS_DYNAMICS_RANDOM; else { free(setup); diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index eb8cd48..dfe3794 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -302,14 +302,14 @@ static int compose_setup(const til_settings_t *settings, til_setting_t **res_set * going to let the user potentially compose with montage * or rtv as one of the layers. */ - if (!strcmp(layer, "compose")) { /* XXX: prevent infinite recursion */ + if (!strcasecmp(layer, "compose")) { /* XXX: prevent infinite recursion */ til_setup_free(&setup->til_setup); return -EINVAL; } for (i = 0; i < n_modules; i++) { - if (!strcmp(layer, modules[i]->name)) + if (!strcasecmp(layer, modules[i]->name)) break; } diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 3e789ab..d60a4cd 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -195,7 +195,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) static int rtv_should_skip_module(const rtv_setup_t *setup, const til_module_t *module) { if (module == &rtv_module || - (setup->snow_module && !strcmp(module->name, setup->snow_module))) + (setup->snow_module && !strcasecmp(module->name, setup->snow_module))) return 1; /* An empty channels list is a special case for representing "all", an @@ -205,7 +205,7 @@ static int rtv_should_skip_module(const rtv_setup_t *setup, const til_module_t * return 0; for (char * const *channel = setup->channels; *channel; channel++) { - if (!strcmp(module->name, *channel)) + if (!strcasecmp(module->name, *channel)) return 0; } @@ -404,7 +404,7 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting return -ENOMEM; /* turn channels colon-separated list into a null-terminated array of strings */ - if (strcmp(channels, "all")) { + if (strcasecmp(channels, "all")) { const til_module_t **modules; size_t n_modules; char *tokchannels, *channel; @@ -425,7 +425,7 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting size_t i; for (i = 0; i < n_modules; i++) { - if (!strcmp(channel, modules[i]->name)) + if (!strcasecmp(channel, modules[i]->name)) break; } @@ -450,7 +450,7 @@ static int rtv_setup(const til_settings_t *settings, til_setting_t **res_setting } while ((channel = strtok(NULL, ":"))); } - if (strcmp(snow_module, "none")) + if (strcasecmp(snow_module, "none")) setup->snow_module = strdup(snow_module); /* TODO FIXME: parse errors */ diff --git a/src/modules/shapes/shapes.c b/src/modules/shapes/shapes.c index 8479c71..a746f77 100644 --- a/src/modules/shapes/shapes.c +++ b/src/modules/shapes/shapes.c @@ -389,7 +389,7 @@ static int shapes_setup(const til_settings_t *settings, til_setting_t **res_sett if (r) return r; - if (strcmp(pinch, "0")) { + if (strcasecmp(pinch, "0")) { r = til_settings_get_and_describe_value(settings, &(til_setting_desc_t){ .name = "Pinch spin factor", diff --git a/src/modules/swarm/swarm.c b/src/modules/swarm/swarm.c index a57c9fe..d45c926 100644 --- a/src/modules/swarm/swarm.c +++ b/src/modules/swarm/swarm.c @@ -456,7 +456,7 @@ static int swarm_setup(const til_settings_t *settings, til_setting_t **res_setti return -ENOMEM; for (int i = 0; styles[i]; i++) { - if (!strcmp(styles[i], style)) + if (!strcasecmp(styles[i], style)) setup->draw_style = i; } diff --git a/src/setup.c b/src/setup.c index 0791da8..a5b1c70 100644 --- a/src/setup.c +++ b/src/setup.c @@ -78,7 +78,7 @@ int setup_interactively(til_settings_t *settings, int (*setup_func)(til_settings desc->annotations ? ": " : "", desc->annotations ? desc->annotations[i] : ""); - if (!strcmp(desc->preferred, desc->values[i])) + if (!strcasecmp(desc->preferred, desc->values[i])) preferred = i; } diff --git a/src/til_args.c b/src/til_args.c index b010b04..e06d0d9 100644 --- a/src/til_args.c +++ b/src/til_args.c @@ -40,13 +40,13 @@ static int args_parse(int argc, const char *argv[], til_args_t *res_args, int *r /* this is intentionally being kept very simple, no new dependencies like getopt. */ for (int i = 1; i < argc; i++) { - if (!strncmp("--video=", argv[i], 8)) { + if (!strncasecmp("--video=", argv[i], 8)) { res_args->video = &argv[i][8]; - } else if (!strncmp("--module=", argv[i], 9)) { + } else if (!strncasecmp("--module=", argv[i], 9)) { res_args->module = &argv[i][9]; - } else if (!strcmp("--defaults", argv[i])) { + } else if (!strcasecmp("--defaults", argv[i])) { res_args->use_defaults = 1; - } else if (!strcmp("--help", argv[i])) { + } else if (!strcasecmp("--help", argv[i])) { res_args->help = 1; } else { if (!res_argv) diff --git a/src/til_settings.c b/src/til_settings.c index 35bb85c..1d01d8e 100644 --- a/src/til_settings.c +++ b/src/til_settings.c @@ -146,7 +146,7 @@ const char * til_settings_get_value(const til_settings_t *settings, const char * assert(key); for (int i = 0; i < settings->num; i++) { - if (!strcmp(key, settings->settings[i]->key)) { + if (!strcasecmp(key, settings->settings[i]->key)) { if (res_setting) *res_setting = settings->settings[i]; |