mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Enclose macro arguments in parentheses
This commit is contained in:
parent
61bae4c9d2
commit
8c1f5c5a6f
8
Panel.h
8
Panel.h
@ -27,11 +27,11 @@ typedef enum HandlerResult_ {
|
||||
SYNTH_KEY = 0x20,
|
||||
} HandlerResult;
|
||||
|
||||
#define EVENT_SET_SELECTED -1
|
||||
#define EVENT_SET_SELECTED (-1)
|
||||
|
||||
#define EVENT_HEADER_CLICK(x_) (-10000 + x_)
|
||||
#define EVENT_IS_HEADER_CLICK(ev_) (ev_ >= -10000 && ev_ <= -9000)
|
||||
#define EVENT_HEADER_CLICK_GET_X(ev_) (ev_ + 10000)
|
||||
#define EVENT_HEADER_CLICK(x_) (-10000 + (x_))
|
||||
#define EVENT_IS_HEADER_CLICK(ev_) ((ev_) >= -10000 && (ev_) <= -9000)
|
||||
#define EVENT_HEADER_CLICK_GET_X(ev_) ((ev_) + 10000)
|
||||
|
||||
typedef HandlerResult(*Panel_EventHandler)(Panel*, int);
|
||||
|
||||
|
@ -15,13 +15,13 @@ in the source distribution for its full text.
|
||||
#define RichString_size(this) ((this)->chlen)
|
||||
#define RichString_sizeVal(this) ((this).chlen)
|
||||
|
||||
#define RichString_begin(this) RichString (this); memset(&this, 0, sizeof(RichString)); (this).chptr = (this).chstr;
|
||||
#define RichString_beginAllocated(this) memset(&this, 0, sizeof(RichString)); (this).chptr = (this).chstr;
|
||||
#define RichString_begin(this) RichString (this); memset(&(this), 0, sizeof(RichString)); (this).chptr = (this).chstr;
|
||||
#define RichString_beginAllocated(this) memset(&(this), 0, sizeof(RichString)); (this).chptr = (this).chstr;
|
||||
#define RichString_end(this) RichString_prune(&(this));
|
||||
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
#define RichString_printVal(this, y, x) mvadd_wchstr(y, x, (this).chptr)
|
||||
#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + off, n)
|
||||
#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + (off), n)
|
||||
#define RichString_getCharVal(this, i) ((this).chptr[i].chars[0] & 255)
|
||||
#define RichString_setChar(this, at, ch) do{ (this)->chptr[(at)] = (CharType) { .chars = { ch, 0 } }; } while(0)
|
||||
#define CharType cchar_t
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user