commit 2314a1932ff8d563bf183ff15cd804c8a43881e8
parent fb5eb4856b46fd19ea6d403ba695ba27845b529d
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 25 May 2021 15:14:10 +0200
tweaks: use a symbol instead of a hard-coded number
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -991,9 +991,10 @@ void parse_includes(char *ptr)
free(expanded);
}
-const char hues[9][7] = { "pink", "purple", "mauve", "lagoon", "mint",
+#define COLORCOUNT 9
+const char hues[COLORCOUNT][7] = { "pink", "purple", "mauve", "lagoon", "mint",
"lime", "peach", "orange", "latte" };
-short indices[9] = { 204, 163, 134, 38, 48, 148, 215, 208, 137 };
+short indices[COLORCOUNT] = { 204, 163, 134, 38, 48, 148, 215, 208, 137 };
/* Return the short value corresponding to the given color name, and set
* vivid to TRUE for a lighter color, and thick for a heavier typeface. */
@@ -1032,7 +1033,7 @@ short color_to_short(const char *colorname, bool *vivid, bool *thick)
else if (strcmp(colorname, "normal") == 0)
return THE_DEFAULT;
else
- for (int index = 0; index < 9; index++)
+ for (int index = 0; index < COLORCOUNT; index++)
if (strcmp(colorname, hues[index]) == 0) {
if (*vivid) {
jot_error(N_("Color '%s' takes no prefix"), colorname);