]> granicus.if.org Git - neomutt/commitdiff
refactor: tidy naming of color functions
authorRichard Russon <rich@flatcap.org>
Fri, 27 Sep 2019 11:37:23 +0000 (12:37 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 28 Sep 2019 02:18:27 +0000 (03:18 +0100)
Tidy colour functions for consistency.

color.c
color.h
main.c
menu.c
pager.c

diff --git a/color.c b/color.c
index 4902f9cd434a9a7a033a51138930d4c8db158447..7ec9d447aa57a0b85417e0d652f7fc49913128bf 100644 (file)
--- a/color.c
+++ b/color.c
@@ -206,9 +206,9 @@ static void color_line_free(struct ColorLine **ptr, bool free_colors)
 }
 
 /**
- * ci_start_color - Set up the default colours
+ * mutt_color_init - Set up the default colours
  */
-void ci_start_color(void)
+void mutt_color_init(void)
 {
   memset(ColorDefs, A_NORMAL, sizeof(int) * MT_COLOR_MAX);
   ColorQuote = mutt_mem_malloc(COLOR_QUOTE_INIT * sizeof(int));
@@ -286,12 +286,12 @@ static char *get_color_name(char *dest, size_t destlen, uint32_t val)
 #endif
 
 /**
- * mutt_alloc_color - Allocate a colour pair
+ * mutt_color_alloc - Allocate a colour pair
  * @param fg Foreground colour ID
  * @param bg Background colour ID
  * @retval num Combined colour pair
  */
-int mutt_alloc_color(uint32_t fg, uint32_t bg)
+int mutt_color_alloc(uint32_t fg, uint32_t bg)
 {
 #ifdef USE_SLANG_CURSES
   char fgc[128], bgc[128];
@@ -390,12 +390,12 @@ static int mutt_lookup_color(short pair, uint32_t *fg, uint32_t *bg)
 }
 
 /**
- * mutt_combine_color - Combine two colours
+ * mutt_color_combine - Combine two colours
  * @param fg_attr Colour pair of foreground to use
  * @param bg_attr Colour pair of background to use
  * @retval num Colour pair of combined colour
  */
-int mutt_combine_color(uint32_t fg_attr, uint32_t bg_attr)
+int mutt_color_combine(uint32_t fg_attr, uint32_t bg_attr)
 {
   uint32_t fg = COLOR_DEFAULT;
   uint32_t bg = COLOR_DEFAULT;
@@ -405,7 +405,7 @@ int mutt_combine_color(uint32_t fg_attr, uint32_t bg_attr)
 
   if ((fg == COLOR_DEFAULT) && (bg == COLOR_DEFAULT))
     return A_NORMAL;
-  return mutt_alloc_color(fg, bg);
+  return mutt_color_alloc(fg, bg);
 }
 
 /**
@@ -791,7 +791,7 @@ static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
         mutt_color_free(tmp->fg, tmp->bg);
         tmp->fg = fg;
         tmp->bg = bg;
-        attr |= mutt_alloc_color(fg, bg);
+        attr |= mutt_color_alloc(fg, bg);
       }
       else
         attr |= (tmp->pair & ~A_BOLD);
@@ -838,7 +838,7 @@ static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
     {
       tmp->fg = fg;
       tmp->bg = bg;
-      attr |= mutt_alloc_color(fg, bg);
+      attr |= mutt_color_alloc(fg, bg);
     }
 #endif
     tmp->pair = attr;
@@ -1037,7 +1037,7 @@ static int fgbgattr_to_color(int fg, int bg, int attr)
 {
 #ifdef HAVE_COLOR
   if ((fg != COLOR_UNSET) && (bg != COLOR_UNSET))
-    return attr | mutt_alloc_color(fg, bg);
+    return attr | mutt_color_alloc(fg, bg);
   else
 #endif
     return attr;
diff --git a/color.h b/color.h
index b14e80194557329b130c1cea3960e4c445e99d9a..97ff26c3f6d61ddbad138a2fef18aeb715cf13d7 100644 (file)
--- a/color.h
+++ b/color.h
@@ -119,11 +119,11 @@ extern struct ColorLineList ColorIndexSubjectList; ///< List of colours applied
 extern struct ColorLineList ColorIndexTagList;     ///< List of colours applied to tags in the index
 extern struct ColorLineList ColorStatusList;       ///< List of colours applied to the status bar
 
-void ci_start_color(void);
-int  mutt_alloc_color(uint32_t fg, uint32_t bg);
-int  mutt_combine_color(uint32_t fg_attr, uint32_t bg_attr);
-void mutt_color_free(uint32_t fg, uint32_t bg);
-void mutt_colors_free(void);
+int  mutt_color_alloc  (uint32_t fg, uint32_t bg);
+int  mutt_color_combine(uint32_t fg_attr, uint32_t bg_attr);
+void mutt_color_free   (uint32_t fg, uint32_t bg);
+void mutt_color_init   (void);
+void mutt_colors_free  (void);
 
 enum CommandResult mutt_parse_color  (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
 enum CommandResult mutt_parse_mono   (struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err);
diff --git a/main.c b/main.c
index adfaa870754d2ae0de566b1d14fb4e4be3c7a93d..8c738917ebf22fc6fde017190e113dce496cccfa 100644 (file)
--- a/main.c
+++ b/main.c
@@ -314,7 +314,7 @@ static int start_curses(void)
   }
   /* slang requires the signal handlers to be set after initializing */
   mutt_signal_init();
-  ci_start_color();
+  mutt_color_init();
   keypad(stdscr, true);
   cbreak();
   noecho();
diff --git a/menu.c b/menu.c
index 1b15649652b14f05b421f80d405f600966d32a2e..073f24e99bd6e31d04747e3cfcbd1ab8ad1655ff 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -156,7 +156,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, bool do
         /* Combining tree fg color and another bg color requires
          * having use_default_colors, because the other bg color
          * may be undefined. */
-        ATTR_SET(mutt_combine_color(ColorDefs[MT_COLOR_TREE], attr));
+        ATTR_SET(mutt_color_combine(ColorDefs[MT_COLOR_TREE], attr));
 #else
         SET_COLOR(MT_COLOR_TREE);
 #endif
diff --git a/pager.c b/pager.c
index cae0252e84502cc053c1d5100e5c4cdc639a9a64..3afa3ab79246f8cb2ad6f5346963ead8c6e66ba5 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -443,7 +443,7 @@ static void resolve_color(struct Line *line_info, int n, int cnt,
     if ((a->attr & ANSI_COLOR))
     {
       if (a->pair == -1)
-        a->pair = mutt_alloc_color(a->fg, a->bg);
+        a->pair = mutt_color_alloc(a->fg, a->bg);
       color = a->pair;
       if (a->attr & ANSI_BOLD)
         color |= A_BOLD;