slist: Make this header file compatible with C++
C++ requires explicit conversions from a void to a non-void pointer. Signed-off-by: Li Feng <fengli@smartx.com> [ bvanassche: edited commit message, removed casts and changed the declaration type ]
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
if ((*list) == NULL) { \
|
if ((*list) == NULL) { \
|
||||||
ISCSI_LIST_ADD((list), (item)); \
|
ISCSI_LIST_ADD((list), (item)); \
|
||||||
} else { \
|
} else { \
|
||||||
void *head = (*list); \
|
typeof(*list) head = (*list); \
|
||||||
while ((*list)->next) \
|
while ((*list)->next) \
|
||||||
(*list) = (*list)->next; \
|
(*list) = (*list)->next; \
|
||||||
(*list)->next = (item); \
|
(*list)->next = (item); \
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
if ((*list) == (item)) { \
|
if ((*list) == (item)) { \
|
||||||
(*list) = (item)->next; \
|
(*list) = (item)->next; \
|
||||||
} else { \
|
} else { \
|
||||||
void *head = (*list); \
|
typeof(*list) head = (*list); \
|
||||||
while ((*list)->next && (*list)->next != (item)) \
|
while ((*list)->next && (*list)->next != (item)) \
|
||||||
(*list) = (*list)->next; \
|
(*list) = (*list)->next; \
|
||||||
if ((*list)->next != NULL) { \
|
if ((*list)->next != NULL) { \
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
#define ISCSI_LIST_LENGTH(list,length) \
|
#define ISCSI_LIST_LENGTH(list,length) \
|
||||||
do { \
|
do { \
|
||||||
(length) = 0; \
|
(length) = 0; \
|
||||||
void *head = (*list); \
|
typeof(*list) head = (*list); \
|
||||||
while ((*list)) { \
|
while ((*list)) { \
|
||||||
(*list) = (*list)->next; \
|
(*list) = (*list)->next; \
|
||||||
(length)++; \
|
(length)++; \
|
||||||
|
|||||||
Reference in New Issue
Block a user