[sr-dev] git:master: Fixed compile warnings - casts from void at memory allocation

Anca Vamanu anca.vamanu at 1and1.ro
Tue Jan 17 10:35:38 CET 2012


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

Author: Anca Vamanu <anca.vamanu at 1and1.ro>
Committer: Anca Vamanu <anca.vamanu at 1and1.ro>
Date:   Tue Jan 17 11:02:50 2012 +0200

 Fixed compile warnings - casts from void at memory allocation

---

 clist.h    |   10 +++++-----
 str_hash.h |    2 +-
 ut.h       |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/clist.h b/clist.h
index c96a93e..124a83c 100644
--- a/clist.h
+++ b/clist.h
@@ -41,8 +41,8 @@
 /*! \brief circular list */
 #define clist_init(c, next, prev) \
 	do{ \
-		(c)->next=(void*)(c); \
-		(c)->prev=(void*)(c); \
+		(c)->next=(struct str_hash_entry*)(void*)(c); \
+		(c)->prev=(struct str_hash_entry*)(void*)(c); \
 	} while(0)
 
 
@@ -57,7 +57,7 @@
  */
 #define clist_insert_sublist(head, s, e, next, prev) \
 	do{ \
-		(s)->prev=(void*)(head); \
+		(s)->prev=(struct str_hash_entry*)(void*)(head); \
 		(e)->next=(head)->next; \
 		(e)->next->prev=(e); \
 		(head)->next=s;   \
@@ -91,8 +91,8 @@
  *  instead! */
 #define clist_rm_sublist(s, e, next, prev) \
 	do{\
-		(s)->prev->next=(e)->next;  \
-		(e)->next->prev=(s)->prev ; \
+		(s)->prev->next=(struct str_hash_entry*)(e)->next;  \
+		(e)->next->prev=(struct str_hash_entry*)(s)->prev ; \
 	}while(0)
 
 
diff --git a/str_hash.h b/str_hash.h
index 1de9748..62423f1 100644
--- a/str_hash.h
+++ b/str_hash.h
@@ -66,7 +66,7 @@ struct str_hash_table{
 /* returns 0 on success, <0 on failure */
 inline static int str_hash_alloc(struct str_hash_table* ht, int size)
 {
-	ht->table=pkg_malloc(sizeof(struct str_hash_head)*size);
+	ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
 	if (ht->table==0)
 		return -1;
 	ht->size=size;
diff --git a/ut.h b/ut.h
index eaec93f..d7d09e6 100644
--- a/ut.h
+++ b/ut.h
@@ -695,7 +695,7 @@ static inline int str2sint(str* _s, int* _r)
  */
 static inline int shm_str_dup(str* dst, const str* src)
 {
-	dst->s = shm_malloc(src->len);
+	dst->s = (char*)shm_malloc(src->len);
 	if (!dst->s) {
 		SHM_MEM_ERROR;
 		return -1;
@@ -717,7 +717,7 @@ static inline int shm_str_dup(str* dst, const str* src)
  */
 static inline int pkg_str_dup(str* dst, const str* src)
 {
-	dst->s = pkg_malloc(src->len);
+	dst->s = (char*)pkg_malloc(src->len);
 	if (dst->s==NULL)
 	{
 		PKG_MEM_ERROR;




More information about the sr-dev mailing list