[SR-Dev] git:ser_core_cvs: Use explicit comparison with NULL, it' s more clear and shuts off gcc,

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Dec 16 16:02:51 CET 2008


Module: sip-router
Branch: ser_core_cvs
Commit: 2577e2f300c64e5ef88b10ec0941906dee7e0af5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2577e2f300c64e5ef88b10ec0941906dee7e0af5

Author: Maxim Sobolev <sobomax at sippysoft.com>
Committer: Maxim Sobolev <sobomax at sippysoft.com>
Date:   Mon Dec  8 06:16:52 2008 +0000

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.

---

 lib/cds/sstr.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cds/sstr.h b/lib/cds/sstr.h
index 7dc331e..64b96b4 100644
--- a/lib/cds/sstr.h
+++ b/lib/cds/sstr.h
@@ -77,7 +77,7 @@ char *zt_strdup(const char*src);
 
 /** frees string content if allocated */
 /* void str_free_content(str_t *s); */
-#define str_free_content(str)	do { if (str) { \
+#define str_free_content(str)	do { if (str != NULL) { \
 		if (((str)->len > 0) && ((str)->s)) cds_free((str)->s);\
 		(str)->len = 0; \
 		(str)->s = 0; \
@@ -85,13 +85,13 @@ char *zt_strdup(const char*src);
 
 /** frees string content if allocated and then the string itself */
 /* void str_free(str_t *s); */
-#define str_free(str)	do { if (str) { \
+#define str_free(str)	do { if (str != NULL) { \
 		if (((str)->len > 0) && ((str)->s)) cds_free((str)->s);\
 		cds_free(str); \
 	} } while (0)
 
 /* clears string content */
-#define str_clear(str)	do { if (str) { \
+#define str_clear(str)	do { if (str != NULL) { \
 		(str)->len = 0; \
 		(str)->s = 0; \
 	} } while (0)




More information about the sr-dev mailing list