mirror of
https://github.com/cuberite/libevent.git
synced 2025-08-04 01:36:23 -04:00
Make event_count macros cleaner
Fixes: #489 (cherry picked from commit 177e2171cb44e3929fbb0ec43b1bffb325b0e8ed)
This commit is contained in:
parent
7f0a7564c3
commit
27a2ef5c8b
10
event.c
10
event.c
@ -3150,10 +3150,6 @@ timeout_process(struct event_base *base)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (EVLIST_INTERNAL >> 4) != 1
|
|
||||||
#error "Mismatch for value of EVLIST_INTERNAL"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MAX
|
#ifndef MAX
|
||||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
#endif
|
#endif
|
||||||
@ -3161,13 +3157,13 @@ timeout_process(struct event_base *base)
|
|||||||
#define MAX_EVENT_COUNT(var, v) var = MAX(var, v)
|
#define MAX_EVENT_COUNT(var, v) var = MAX(var, v)
|
||||||
|
|
||||||
/* These are a fancy way to spell
|
/* These are a fancy way to spell
|
||||||
if (flags & EVLIST_INTERNAL)
|
if (~flags & EVLIST_INTERNAL)
|
||||||
base->event_count--/++;
|
base->event_count--/++;
|
||||||
*/
|
*/
|
||||||
#define DECR_EVENT_COUNT(base,flags) \
|
#define DECR_EVENT_COUNT(base,flags) \
|
||||||
((base)->event_count -= (~((flags) >> 4) & 1))
|
((base)->event_count -= !((flags) & EVLIST_INTERNAL))
|
||||||
#define INCR_EVENT_COUNT(base,flags) do { \
|
#define INCR_EVENT_COUNT(base,flags) do { \
|
||||||
((base)->event_count += (~((flags) >> 4) & 1)); \
|
((base)->event_count += !((flags) & EVLIST_INTERNAL)); \
|
||||||
MAX_EVENT_COUNT((base)->event_count_max, (base)->event_count); \
|
MAX_EVENT_COUNT((base)->event_count_max, (base)->event_count); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user