By putting the code into a "do { } while (0)" loop it is treated like a single
statement and does not break "if () sfree()" like constructs.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
#endif
#define sfree(ptr) \
- if((ptr) != NULL) { \
- free(ptr); \
- } \
- (ptr) = NULL
+ do { \
+ if((ptr) != NULL) { \
+ free(ptr); \
+ } \
+ (ptr) = NULL; \
+ } while (0)
#define STATIC_ARRAY_SIZE(a) (sizeof (a) / sizeof (*(a)))