i3/i3bar/include/util.h

23 lines
340 B
C
Raw Normal View History

2010-07-21 19:15:18 -04:00
#ifndef UTIL_H_
#define UTIL_H_
/* Securely free p */
#define FREE(p) do { \
if (p != NULL) { \
free(p); \
p = NULL; \
} \
} while (0)
/* Securely fee single-linked list */
#define FREE_LIST(l, type) do { \
type* FREE_LIST_TMP; \
while (l != NULL) { \
FREE_LIST_TMP = l; \
free(l); \
l = l->next; \
} \
} while (0)
#endif