mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
Enclose macro arguments in parentheses
This commit is contained in:

committed by
cgzones

parent
61bae4c9d2
commit
8c1f5c5a6f
@ -28,7 +28,7 @@ enum {
|
||||
|
||||
typedef int IOPriority;
|
||||
|
||||
#define IOPriority_tuple(class_, data_) (((class_) << IOPRIO_CLASS_SHIFT) | data_)
|
||||
#define IOPriority_tuple(class_, data_) (((class_) << IOPRIO_CLASS_SHIFT) | (data_))
|
||||
|
||||
#define IOPriority_error 0xffffffff
|
||||
|
||||
|
@ -1161,7 +1161,7 @@ static inline void LinuxProcessList_scanZfsArcstats(LinuxProcessList* lpl) {
|
||||
char buffer[128];
|
||||
while (fgets(buffer, 128, file)) {
|
||||
#define tryRead(label, variable) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %*2u %32llu", variable)) { break; } } while(0)
|
||||
#define tryReadFlag(label, variable, flag) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %*2u %32llu", variable)) { flag = 1; break; } else { flag = 0; } } while(0)
|
||||
#define tryReadFlag(label, variable, flag) do { if (String_startsWith(buffer, label) && sscanf(buffer + strlen(label), " %*2u %32llu", variable)) { (flag) = 1; break; } else { (flag) = 0; } } while(0)
|
||||
switch (buffer[0]) {
|
||||
case 'c':
|
||||
tryRead("c_max", &lpl->zfs.max);
|
||||
@ -1248,7 +1248,7 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
|
||||
// Since we do a subtraction (usertime - guest) and cputime64_to_clock_t()
|
||||
// used in /proc/stat rounds down numbers, it can lead to a case where the
|
||||
// integer overflow.
|
||||
#define WRAP_SUBTRACT(a,b) (a > b) ? a - b : 0
|
||||
#define WRAP_SUBTRACT(a,b) (((a) > (b)) ? (a) - (b) : 0)
|
||||
cpuData->userPeriod = WRAP_SUBTRACT(usertime, cpuData->userTime);
|
||||
cpuData->nicePeriod = WRAP_SUBTRACT(nicetime, cpuData->niceTime);
|
||||
cpuData->systemPeriod = WRAP_SUBTRACT(systemtime, cpuData->systemTime);
|
||||
|
Reference in New Issue
Block a user