summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 540e2d3)
raw | patch | inline | side by side (parent: 540e2d3)
author | Sebastian Harl <sh@tokkee.org> | |
Mon, 18 Aug 2008 07:30:03 +0000 (09:30 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 19 Aug 2008 08:08:51 +0000 (10:08 +0200) |
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>
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>
src/common.h | patch | blob | history |
diff --git a/src/common.h b/src/common.h
index e99aea697e45f854b30a50d0b089b8cf20ddf406..9e7e4aa39d9319af5c7b3303ac252e8572f8dcbc 100644 (file)
--- a/src/common.h
+++ b/src/common.h
#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)))