Browse code

Use explicit comparison with NULL, it's more clear and shuts off gcc, which otherwise compain that condition is always true when argument is pointer to the struct allocated on stack.

Maxim Sobolev authored on 08/12/2008 06:16:52
Showing 1 changed files
... ...
@@ -77,7 +77,7 @@ char *zt_strdup(const char*src);
77 77
 
78 78
 /** frees string content if allocated */
79 79
 /* void str_free_content(str_t *s); */
80
-#define str_free_content(str)	do { if (str) { \
80
+#define str_free_content(str)	do { if (str != NULL) { \
81 81
 		if (((str)->len > 0) && ((str)->s)) cds_free((str)->s);\
82 82
 		(str)->len = 0; \
83 83
 		(str)->s = 0; \
... ...
@@ -85,13 +85,13 @@ char *zt_strdup(const char*src);
85 85
 
86 86
 /** frees string content if allocated and then the string itself */
87 87
 /* void str_free(str_t *s); */
88
-#define str_free(str)	do { if (str) { \
88
+#define str_free(str)	do { if (str != NULL) { \
89 89
 		if (((str)->len > 0) && ((str)->s)) cds_free((str)->s);\
90 90
 		cds_free(str); \
91 91
 	} } while (0)
92 92
 
93 93
 /* clears string content */
94
-#define str_clear(str)	do { if (str) { \
94
+#define str_clear(str)	do { if (str != NULL) { \
95 95
 		(str)->len = 0; \
96 96
 		(str)->s = 0; \
97 97
 	} } while (0)