commit 6e37723fbe9f0588bbf6c62c15a920e263746216
parent b8aae4d87250c82be0eb3f39c09bb418745d3f16
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 11 Mar 2016 16:45:00 +0000
Eliding a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5720 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git 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 <bensberg@justemail.net>
* src/rcfile.c (grab_and_store): Do not accept 'header" and 'magic'
diff --git 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