tweaks: rename two variables, for preciseness and shortness

Also remove an unneeded nulling.
master
Benno Schulenberg 2018-01-15 16:07:24 +01:00
parent 64366d9992
commit 704a7d7b4f
4 changed files with 18 additions and 19 deletions

View File

@ -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

View File

@ -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. */

View File

@ -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];

View File

@ -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