From 0cd833e64bcdffbac9ec63f6c0c05fe6be4c4541 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 30 Mar 2018 10:25:39 +0200
Subject: [PATCH] tweaks: move a function to its proper location

Put it after the function that it calls, and before the functions
it is called from.
---
 src/proto.h  |  1 -
 src/rcfile.c | 56 ++++++++++++++++++++++++++--------------------------
 2 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/src/proto.h b/src/proto.h
index cda49650..00d37ccc 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -471,7 +471,6 @@ int do_yesno_prompt(bool all, const char *msg);
 /* Most functions in rcfile.c. */
 #ifdef ENABLE_NANORC
 #ifdef ENABLE_COLOR
-bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
 void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
 #endif
 void parse_rcfile(FILE *rcstream, bool syntax_only);
diff --git a/src/rcfile.c b/src/rcfile.c
index 2b81cb0c..6193dfcb 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -609,6 +609,34 @@ short color_to_short(const char *colorname, bool *bright)
 	return -2;
 }
 
+/* Parse the color name (or pair of color names) in the given string.
+ * Return FALSE when any color name is invalid; otherwise return TRUE. */
+bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
+{
+	char *comma = strchr(combostr, ',');
+
+	if (comma != NULL) {
+		*bg = color_to_short(comma + 1, bright);
+		if (*bright) {
+			rcfile_error(N_("A background color cannot be bright"));
+			return FALSE;
+		}
+		if (*bg == -2)
+			return FALSE;
+		*comma = '\0';
+	} else
+		*bg = -1;
+
+	if (comma != combostr) {
+		*fg = color_to_short(combostr, bright);
+		if (*fg == -2)
+			return FALSE;
+	} else
+		*fg = -1;
+
+	return TRUE;
+}
+
 /* Parse the color string in the line at ptr, and add it to the current
  * file's associated colors.  rex_flags are the regex compilation flags
  * to use, excluding or including REG_ICASE for case (in)sensitivity. */
@@ -736,34 +764,6 @@ void parse_colors(char *ptr, int rex_flags)
 	}
 }
 
-/* Parse the color name (or pair of color names) in the given string.
- * Return FALSE when any color name is invalid; otherwise return TRUE. */
-bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
-{
-	char *comma = strchr(combostr, ',');
-
-	if (comma != NULL) {
-		*bg = color_to_short(comma + 1, bright);
-		if (*bright) {
-			rcfile_error(N_("A background color cannot be bright"));
-			return FALSE;
-		}
-		if (*bg == -2)
-			return FALSE;
-		*comma = '\0';
-	} else
-		*bg = -1;
-
-	if (comma != combostr) {
-		*fg = color_to_short(combostr, bright);
-		if (*fg == -2)
-			return FALSE;
-	} else
-		*fg = -1;
-
-	return TRUE;
-}
-
 /* Parse the argument of an interface color option. */
 colortype *parse_interface_color(char *combostr)
 {
-- 
GitLab