mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Linux: improve tryRead macro safety
Add an explicit else clause so a following else branch for a prior if condition does not get mixed up. Also force a trailing semicolon and thereby silence current -Wextra-semi-stmt warnings. Improve readability of the hwloc_bitmap_foreach_begin loop macro.
This commit is contained in:

committed by
BenBE

parent
ae1816e563
commit
970885edc3
@ -1609,7 +1609,7 @@ static inline void LinuxProcessList_scanMemoryInfo(ProcessList* this) {
|
||||
(variable) = parsed_; \
|
||||
} \
|
||||
break; \
|
||||
}
|
||||
} else (void) 0 /* Require a ";" after the macro use. */
|
||||
|
||||
switch (buffer[0]) {
|
||||
case 'M':
|
||||
@ -1785,12 +1785,12 @@ static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
|
||||
if (String_startsWith(buffer, label)) { \
|
||||
sscanf(buffer + strlen(label), " %*2u %32llu", variable); \
|
||||
break; \
|
||||
}
|
||||
} else (void) 0 /* Require a ";" after the macro use. */
|
||||
#define tryReadFlag(label, variable, flag) \
|
||||
if (String_startsWith(buffer, label)) { \
|
||||
(flag) = sscanf(buffer + strlen(label), " %*2u %32llu", variable); \
|
||||
break; \
|
||||
}
|
||||
} else (void) 0 /* Require a ";" after the macro use. */
|
||||
|
||||
switch (buffer[0]) {
|
||||
case 'c':
|
||||
|
Reference in New Issue
Block a user