tweaks: use a symbol instead of a hard-coded number

master
Benno Schulenberg 2021-05-25 15:14:10 +02:00
parent fb5eb4856b
commit 2314a1932f
1 changed files with 4 additions and 3 deletions

View File

@ -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);