From db0a13970ed512a75ade9770f0a1aa468f657f8b Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 31 Oct 2020 20:26:53 +0100 Subject: Convert addattrstr to static inline function NB: The macro could have been a braced while(0) loop, which without optimization produces more code --- Action.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Action.c') diff --git a/Action.c b/Action.c index 5b68811e..303eeeaf 100644 --- a/Action.c +++ b/Action.c @@ -443,6 +443,11 @@ static const struct { const char* key; const char* info; } helpRight[] = { { .key = NULL, .info = NULL } }; +static inline void addattrstr( int attr, const char* str) { + attrset(attr); + addstr(str); +} + static Htop_Reaction actionHelp(State* st) { Settings* settings = st->settings; @@ -460,7 +465,7 @@ static Htop_Reaction actionHelp(State* st) { attrset(CRT_colors[DEFAULT_COLOR]); line++; mvaddstr(line++, 0, "CPU usage bar: "); - #define addattrstr(a,s) attrset(a);addstr(s) + addattrstr(CRT_colors[BAR_BORDER], "["); if (settings->detailedCPUTime) { addattrstr(CRT_colors[CPU_NICE_TEXT], "low"); addstr("/"); -- cgit v1.2.3