Convert addattrstr to static inline function

NB: The macro could have been a braced while(0) loop, which without optimization produces more code
This commit is contained in:
Benny Baumann 2020-10-31 20:26:53 +01:00
parent c790b6ae67
commit db0a13970e
1 changed files with 6 additions and 1 deletions

View File

@ -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("/");