2 * i3bar - an xcb-based status- and ws-bar for i3
4 * © 2010 Axel Wagner and contributors
6 * See file LICNSE for license information
14 /* Get the maximum/minimum of x and y */
15 #define MAX(x,y) ((x) > (y) ? (x) : (y))
16 #define MIN(x,y) ((x) < (y) ? (x) : (y))
19 #define FREE(p) do { \
26 /* Securely fee single-linked list */
27 #define FREE_SLIST(l, type) do { \
28 type *walk = SLIST_FIRST(l); \
29 while (!SLIST_EMPTY(l)) { \
30 SLIST_REMOVE_HEAD(l, slist); \
32 walk = SLIST_FIRST(l); \
38 /* Securely fee tail-queues */
39 #define FREE_TAILQ(l, type) do { \
40 type *walk = TAILQ_FIRST(l); \
41 while (!TAILQ_EMPTY(l)) { \
42 TAILQ_REMOVE(l, TAILQ_FIRST(l), tailq); \
44 walk = TAILQ_FIRST(l); \
48 /* Use cool logging-macros */
49 #define DLOG(fmt, ...) do { \
50 if (config.verbose) { \
51 printf("[%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
55 #define ELOG(fmt, ...) do { \
56 fprintf(stderr, "[%s:%d] ERROR: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \