Browse code

Fixed compile warnings - casts from void at memory allocation

Anca Vamanu authored on 17/01/2012 09:02:50
Showing 3 changed files
... ...
@@ -41,8 +41,8 @@
41 41
 /*! \brief circular list */
42 42
 #define clist_init(c, next, prev) \
43 43
 	do{ \
44
-		(c)->next=(void*)(c); \
45
-		(c)->prev=(void*)(c); \
44
+		(c)->next=(struct str_hash_entry*)(void*)(c); \
45
+		(c)->prev=(struct str_hash_entry*)(void*)(c); \
46 46
 	} while(0)
47 47
 
48 48
 
... ...
@@ -57,7 +57,7 @@
57 57
  */
58 58
 #define clist_insert_sublist(head, s, e, next, prev) \
59 59
 	do{ \
60
-		(s)->prev=(void*)(head); \
60
+		(s)->prev=(struct str_hash_entry*)(void*)(head); \
61 61
 		(e)->next=(head)->next; \
62 62
 		(e)->next->prev=(e); \
63 63
 		(head)->next=s;   \
... ...
@@ -91,8 +91,8 @@
91 91
  *  instead! */
92 92
 #define clist_rm_sublist(s, e, next, prev) \
93 93
 	do{\
94
-		(s)->prev->next=(e)->next;  \
95
-		(e)->next->prev=(s)->prev ; \
94
+		(s)->prev->next=(struct str_hash_entry*)(e)->next;  \
95
+		(e)->next->prev=(struct str_hash_entry*)(s)->prev ; \
96 96
 	}while(0)
97 97
 
98 98
 
... ...
@@ -66,7 +66,7 @@ struct str_hash_table{
66 66
 /* returns 0 on success, <0 on failure */
67 67
 inline static int str_hash_alloc(struct str_hash_table* ht, int size)
68 68
 {
69
-	ht->table=pkg_malloc(sizeof(struct str_hash_head)*size);
69
+	ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
70 70
 	if (ht->table==0)
71 71
 		return -1;
72 72
 	ht->size=size;
... ...
@@ -695,7 +695,7 @@ static inline int str2sint(str* _s, int* _r)
695 695
  */
696 696
 static inline int shm_str_dup(str* dst, const str* src)
697 697
 {
698
-	dst->s = shm_malloc(src->len);
698
+	dst->s = (char*)shm_malloc(src->len);
699 699
 	if (!dst->s) {
700 700
 		SHM_MEM_ERROR;
701 701
 		return -1;
... ...
@@ -717,7 +717,7 @@ static inline int shm_str_dup(str* dst, const str* src)
717 717
  */
718 718
 static inline int pkg_str_dup(str* dst, const str* src)
719 719
 {
720
-	dst->s = pkg_malloc(src->len);
720
+	dst->s = (char*)pkg_malloc(src->len);
721 721
 	if (dst->s==NULL)
722 722
 	{
723 723
 		PKG_MEM_ERROR;