basic/term-util: inline colors_enabled function

There is no need to cache colors_enabled because the function
is now simply calling get_color_mode, which is already cached.
This commit is contained in:
rnhmjoj
2020-12-15 19:40:30 +01:00
parent 25e4608b8b
commit dcdd9030ba
2 changed files with 6 additions and 13 deletions
-12
View File
@@ -47,7 +47,6 @@ static volatile unsigned cached_columns = 0;
static volatile unsigned cached_lines = 0;
static volatile int cached_on_tty = -1;
static volatile int cached_colors_enabled = -1;
static volatile int cached_color_mode = _COLOR_INVALID;
static volatile int cached_underline_enabled = -1;
@@ -864,7 +863,6 @@ void reset_terminal_feature_caches(void) {
cached_columns = 0;
cached_lines = 0;
cached_colors_enabled = -1;
cached_color_mode = _COLOR_INVALID;
cached_underline_enabled = -1;
cached_on_tty = -1;
@@ -1252,16 +1250,6 @@ ColorMode get_color_mode(void) {
return cached_color_mode;
}
bool colors_enabled(void) {
/* Returns true if colors are considered supported on our stdout. */
if (cached_colors_enabled < 0)
cached_colors_enabled = get_color_mode() != COLOR_OFF;
return cached_colors_enabled;
}
bool dev_console_colors_enabled(void) {
_cleanup_free_ char *s = NULL;
ColorMode m;