Eliding a variable.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5720 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-11 16:45:00 +00:00
parent b8aae4d872
commit 6e37723fbe
2 changed files with 12 additions and 14 deletions

View File

@ -2,6 +2,7 @@
* src/browser.c (do_browser): Fix compilation when configured with * src/browser.c (do_browser): Fix compilation when configured with
--enable-tiny plus --enable-browser. --enable-tiny plus --enable-browser.
* src/rcfile.c: Tweak some comments and reshuffle some lines. * src/rcfile.c: Tweak some comments and reshuffle some lines.
* src/rcfile.c (color_to_short): Elide a variable.
2016-03-10 Benno Schulenberg <bensberg@justemail.net> 2016-03-10 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic' * src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'

View File

@ -590,8 +590,6 @@ void parse_include(char *ptr)
* and set bright to TRUE if that color is bright. */ * and set bright to TRUE if that color is bright. */
short color_to_short(const char *colorname, bool *bright) short color_to_short(const char *colorname, bool *bright)
{ {
short mcolor = -1;
assert(colorname != NULL && bright != NULL); assert(colorname != NULL && bright != NULL);
if (strncasecmp(colorname, "bright", 6) == 0) { if (strncasecmp(colorname, "bright", 6) == 0) {
@ -600,29 +598,28 @@ short color_to_short(const char *colorname, bool *bright)
} }
if (strcasecmp(colorname, "green") == 0) if (strcasecmp(colorname, "green") == 0)
mcolor = COLOR_GREEN; return COLOR_GREEN;
else if (strcasecmp(colorname, "red") == 0) else if (strcasecmp(colorname, "red") == 0)
mcolor = COLOR_RED; return COLOR_RED;
else if (strcasecmp(colorname, "blue") == 0) else if (strcasecmp(colorname, "blue") == 0)
mcolor = COLOR_BLUE; return COLOR_BLUE;
else if (strcasecmp(colorname, "white") == 0) else if (strcasecmp(colorname, "white") == 0)
mcolor = COLOR_WHITE; return COLOR_WHITE;
else if (strcasecmp(colorname, "yellow") == 0) else if (strcasecmp(colorname, "yellow") == 0)
mcolor = COLOR_YELLOW; return COLOR_YELLOW;
else if (strcasecmp(colorname, "cyan") == 0) else if (strcasecmp(colorname, "cyan") == 0)
mcolor = COLOR_CYAN; return COLOR_CYAN;
else if (strcasecmp(colorname, "magenta") == 0) else if (strcasecmp(colorname, "magenta") == 0)
mcolor = COLOR_MAGENTA; return COLOR_MAGENTA;
else if (strcasecmp(colorname, "black") == 0) else if (strcasecmp(colorname, "black") == 0)
mcolor = COLOR_BLACK; return COLOR_BLACK;
else
rcfile_error(N_("Color \"%s\" not understood.\n" rcfile_error(N_("Color \"%s\" not understood.\n"
"Valid colors are \"green\", \"red\", \"blue\",\n" "Valid colors are \"green\", \"red\", \"blue\",\n"
"\"white\", \"yellow\", \"cyan\", \"magenta\" and\n" "\"white\", \"yellow\", \"cyan\", \"magenta\" and\n"
"\"black\", with the optional prefix \"bright\"\n" "\"black\", with the optional prefix \"bright\"\n"
"for foreground colors."), colorname); "for foreground colors."), colorname);
return -1;
return mcolor;
} }
/* Parse the color string in the line at ptr, and add it to the current /* Parse the color string in the line at ptr, and add it to the current