[sr-dev] git:master: modules_k/presence : Fixed a bug caused by an incorrect Macro

Marius Zbihlei marius.zbihlei at 1and1.ro
Wed Apr 27 11:27:46 CEST 2011


Module: sip-router
Branch: master
Commit: 41b11916eec28133af499b7368940504c7c5834d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=41b11916eec28133af499b7368940504c7c5834d

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Wed Apr 27 12:21:11 2011 +0300

modules_k/presence : Fixed a bug caused by an incorrect Macro

the macro expanded to incorrect results when called in statements like
if(cond) COND_COPY(...);

---

 modules_k/presence/hash.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules_k/presence/hash.h b/modules_k/presence/hash.h
index 82eb23c..ba9a0ab 100644
--- a/modules_k/presence/hash.h
+++ b/modules_k/presence/hash.h
@@ -50,10 +50,12 @@ struct presentity;
 						goto error
 
 #define CONT_COPY(buf, dest, source)\
+	do{ \
 	dest.s= (char*)buf+ size;\
 	memcpy(dest.s, source.s, source.len);\
 	dest.len= source.len;\
-	size+= source.len;
+	size+= source.len; \
+	} while(0);
 
 #define PKG_MEM_TYPE     1<< 1
 #define SHM_MEM_TYPE     1<< 2




More information about the sr-dev mailing list