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:
@@ -148,11 +148,16 @@ void reset_terminal_feature_caches(void);
|
||||
|
||||
bool on_tty(void);
|
||||
bool terminal_is_dumb(void);
|
||||
bool colors_enabled(void);
|
||||
ColorMode get_color_mode(void);
|
||||
bool underline_enabled(void);
|
||||
bool dev_console_colors_enabled(void);
|
||||
|
||||
static inline bool colors_enabled(void) {
|
||||
|
||||
/* Returns true if colors are considered supported on our stdout. */
|
||||
return get_color_mode() != COLOR_OFF;
|
||||
}
|
||||
|
||||
#define DEFINE_ANSI_FUNC(name, NAME) \
|
||||
static inline const char *ansi_##name(void) { \
|
||||
return colors_enabled() ? ANSI_##NAME : ""; \
|
||||
|
||||
Reference in New Issue
Block a user