common.h (429B)
1 #pragma once 2 3 #define streq(a, b) (!strcmp(a, b)) 4 5 #define nil ((void*) 0) 6 #define LEN(arr) (sizeof(arr) / sizeof(*arr)) 7 8 #define FALLTHROUGH __attribute__((fallthrough)) 9 10 #define FOREACH(iter, array) for (int(iter) = 0; (iter) < LEN(array); (iter)++) 11 12 #define SET(x) ((x) = 0) 13 #define USED(x) \ 14 if (x) { \ 15 } else { \ 16 } 17 #ifdef __GNUC__ 18 # if __GNUC__ >= 3 19 # undef USED 20 # define USED(x) ((void) (x)) 21 # endif 22 #endif