2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
13 /* Get the maximum/minimum of x and y */
14 #define MAX(x,y) ((x) > (y) ? (x) : (y))
15 #define MIN(x,y) ((x) < (y) ? (x) : (y))
18 #define FREE(p) do { \
25 /* Securely fee single-linked list */
26 #define FREE_SLIST(l, type) do { \
27 type *walk = SLIST_FIRST(l); \
28 while (!SLIST_EMPTY(l)) { \
29 SLIST_REMOVE_HEAD(l, slist); \
31 walk = SLIST_FIRST(l); \
37 /* Securely fee tail-queues */
38 #define FREE_TAILQ(l, type) do { \
39 type *walk = TAILQ_FIRST(l); \
40 while (!TAILQ_EMPTY(l)) { \
41 TAILQ_REMOVE(l, TAILQ_FIRST(l), tailq); \
43 walk = TAILQ_FIRST(l); \
47 /* Use cool logging-macros */
48 #define DLOG(fmt, ...) do { \
49 if (config.verbose) { \
50 printf("[%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
54 #define ELOG(fmt, ...) do { \
55 fprintf(stderr, "[%s:%d] ERROR: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \