From 704a7d7b4f4fec9bf21481ffaf5ec5dfbf2f6f89 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 15 Jan 2018 16:07:24 +0100 Subject: [PATCH] tweaks: rename two variables, for preciseness and shortness Also remove an unneeded nulling. --- src/color.c | 19 +++++++++---------- src/global.c | 4 ++-- src/proto.h | 2 +- src/rcfile.c | 12 ++++++------ 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/color.c b/src/color.c index 9aaa0222..f0e8328a 100644 --- a/src/color.c +++ b/src/color.c @@ -57,16 +57,16 @@ void set_colorpairs(void) /* Initialize the color pairs for nano's interface elements. */ for (i = 0; i < NUMBER_OF_ELEMENTS; i++) { - colortype *color = specified_color_combo[i]; + colortype *combo = color_combo[i]; - if (color != NULL) { - if (color->fg == -1 && !using_defaults) - color->fg = COLOR_WHITE; - if (color->bg == -1 && !using_defaults) - color->bg = COLOR_BLACK; - init_pair(i + 1, color->fg, color->bg); + if (combo != NULL) { + if (combo->fg == -1 && !using_defaults) + combo->fg = COLOR_WHITE; + if (combo->bg == -1 && !using_defaults) + combo->bg = COLOR_BLACK; + init_pair(i + 1, combo->fg, combo->bg); interface_color_pair[i] = COLOR_PAIR(i + 1) | A_BANDAID | - (color->bright ? A_BOLD : A_NORMAL); + (combo->bright ? A_BOLD : A_NORMAL); } else { if (i != FUNCTION_TAG) interface_color_pair[i] = hilite_attribute; @@ -74,8 +74,7 @@ void set_colorpairs(void) interface_color_pair[i] = A_NORMAL; } - free(specified_color_combo[i]); - specified_color_combo[i] = NULL; + free(color_combo[i]); } /* For each syntax, go through its list of colors and assign each diff --git a/src/global.c b/src/global.c index 3896c437..677211be 100644 --- a/src/global.c +++ b/src/global.c @@ -233,8 +233,8 @@ regmatch_t regmatches[10]; int hilite_attribute = A_REVERSE; /* The curses attribute we use to highlight something. */ #ifdef ENABLE_COLOR -colortype* specified_color_combo[] = {NULL}; - /* The color combinations as specified in the rcfile. */ +colortype* color_combo[] = {NULL}; + /* The color combinations for interface elements given in the rcfile. */ #endif int interface_color_pair[] = {0}; /* The processed color pairs for the interface elements. */ diff --git a/src/proto.h b/src/proto.h index e49fa227..77ffc05c 100644 --- a/src/proto.h +++ b/src/proto.h @@ -172,7 +172,7 @@ extern regmatch_t regmatches[10]; extern int hilite_attribute; #ifdef ENABLE_COLOR -extern colortype* specified_color_combo[NUMBER_OF_ELEMENTS]; +extern colortype *color_combo[NUMBER_OF_ELEMENTS]; #endif extern int interface_color_pair[NUMBER_OF_ELEMENTS]; diff --git a/src/rcfile.c b/src/rcfile.c index e6a9a2c2..eece5a8e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1098,17 +1098,17 @@ void parse_rcfile(FILE *rcstream, bool syntax_only) #ifdef ENABLE_COLOR if (strcasecmp(rcopts[i].name, "titlecolor") == 0) - specified_color_combo[TITLE_BAR] = parse_interface_color(option); + color_combo[TITLE_BAR] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "numbercolor") == 0) - specified_color_combo[LINE_NUMBER] = parse_interface_color(option); + color_combo[LINE_NUMBER] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "selectedcolor") == 0) - specified_color_combo[SELECTED_TEXT] = parse_interface_color(option); + color_combo[SELECTED_TEXT] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "statuscolor") == 0) - specified_color_combo[STATUS_BAR] = parse_interface_color(option); + color_combo[STATUS_BAR] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "keycolor") == 0) - specified_color_combo[KEY_COMBO] = parse_interface_color(option); + color_combo[KEY_COMBO] = parse_interface_color(option); else if (strcasecmp(rcopts[i].name, "functioncolor") == 0) - specified_color_combo[FUNCTION_TAG] = parse_interface_color(option); + color_combo[FUNCTION_TAG] = parse_interface_color(option); else #endif #ifdef ENABLE_OPERATINGDIR