diff --git a/ChangeLog b/ChangeLog index 2c11b4ca..758061fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * src/browser.c (do_browser): Fix compilation when configured with --enable-tiny plus --enable-browser. * src/rcfile.c: Tweak some comments and reshuffle some lines. + * src/rcfile.c (color_to_short): Elide a variable. 2016-03-10 Benno Schulenberg * src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic' diff --git a/src/rcfile.c b/src/rcfile.c index d6688484..87cb186f 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -590,8 +590,6 @@ void parse_include(char *ptr) * and set bright to TRUE if that color is bright. */ short color_to_short(const char *colorname, bool *bright) { - short mcolor = -1; - assert(colorname != NULL && bright != NULL); if (strncasecmp(colorname, "bright", 6) == 0) { @@ -600,29 +598,28 @@ short color_to_short(const char *colorname, bool *bright) } if (strcasecmp(colorname, "green") == 0) - mcolor = COLOR_GREEN; + return COLOR_GREEN; else if (strcasecmp(colorname, "red") == 0) - mcolor = COLOR_RED; + return COLOR_RED; else if (strcasecmp(colorname, "blue") == 0) - mcolor = COLOR_BLUE; + return COLOR_BLUE; else if (strcasecmp(colorname, "white") == 0) - mcolor = COLOR_WHITE; + return COLOR_WHITE; else if (strcasecmp(colorname, "yellow") == 0) - mcolor = COLOR_YELLOW; + return COLOR_YELLOW; else if (strcasecmp(colorname, "cyan") == 0) - mcolor = COLOR_CYAN; + return COLOR_CYAN; else if (strcasecmp(colorname, "magenta") == 0) - mcolor = COLOR_MAGENTA; + return COLOR_MAGENTA; else if (strcasecmp(colorname, "black") == 0) - mcolor = COLOR_BLACK; - else - rcfile_error(N_("Color \"%s\" not understood.\n" + return COLOR_BLACK; + + rcfile_error(N_("Color \"%s\" not understood.\n" "Valid colors are \"green\", \"red\", \"blue\",\n" "\"white\", \"yellow\", \"cyan\", \"magenta\" and\n" "\"black\", with the optional prefix \"bright\"\n" "for foreground colors."), colorname); - - return mcolor; + return -1; } /* Parse the color string in the line at ptr, and add it to the current