From 4e8577af1b458f9b6c4fede0d3f50147737c1d1f Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 27 Sep 2019 12:37:23 +0100 Subject: [PATCH] refactor: tidy naming of color functions Tidy colour functions for consistency. --- color.c | 20 ++++++++++---------- color.h | 10 +++++----- main.c | 2 +- menu.c | 2 +- pager.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/color.c b/color.c index 4902f9cd4..7ec9d447a 100644 --- 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 b14e80194..97ff26c3f 100644 --- 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 adfaa8707..8c738917e 100644 --- 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 1b1564965..073f24e99 100644 --- 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 cae0252e8..3afa3ab79 100644 --- 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; -- 2.40.0