mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-23 05:11:35 +03:00
tweaks: elide two ifs for the most likely case, when defaults are allowed
This commit is contained in:
parent
23460bc6a8
commit
454dc6e1ec
20
src/color.c
20
src/color.c
@ -72,10 +72,12 @@ void set_interface_colorpairs(void)
|
||||
colortype *combo = color_combo[index];
|
||||
|
||||
if (combo != NULL) {
|
||||
if (combo->fg == USE_THE_DEFAULT && !defaults_allowed)
|
||||
combo->fg = COLOR_WHITE;
|
||||
if (combo->bg == USE_THE_DEFAULT && !defaults_allowed)
|
||||
combo->bg = COLOR_BLACK;
|
||||
if (!defaults_allowed) {
|
||||
if (combo->fg == USE_THE_DEFAULT)
|
||||
combo->fg = COLOR_WHITE;
|
||||
if (combo->bg == USE_THE_DEFAULT)
|
||||
combo->bg = COLOR_BLACK;
|
||||
}
|
||||
init_pair(index + 1, combo->fg, combo->bg);
|
||||
interface_color_pair[index] = COLOR_PAIR(index + 1) | A_BANDAID |
|
||||
combo->attributes;
|
||||
@ -107,11 +109,13 @@ void prepare_palette(void)
|
||||
foreground = ink->fg;
|
||||
background = ink->bg;
|
||||
|
||||
if (foreground == USE_THE_DEFAULT && !defaults_allowed)
|
||||
foreground = COLOR_WHITE;
|
||||
if (!defaults_allowed) {
|
||||
if (foreground == USE_THE_DEFAULT)
|
||||
foreground = COLOR_WHITE;
|
||||
|
||||
if (background == USE_THE_DEFAULT && !defaults_allowed)
|
||||
background = COLOR_BLACK;
|
||||
if (background == USE_THE_DEFAULT)
|
||||
background = COLOR_BLACK;
|
||||
}
|
||||
|
||||
init_pair(ink->pairnum, foreground, background);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user