From 6b93325b391c057035ea63e3d727cbcaf377c6c6 Mon Sep 17 00:00:00 2001 From: Li Feng Date: Fri, 20 Aug 2021 18:03:57 +0800 Subject: [PATCH] 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 [ bvanassche: edited commit message, removed casts and changed the declaration type ] --- include/slist.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/slist.h b/include/slist.h index 80384a4..3a9a86f 100644 --- a/include/slist.h +++ b/include/slist.h @@ -28,7 +28,7 @@ if ((*list) == NULL) { \ ISCSI_LIST_ADD((list), (item)); \ } else { \ - void *head = (*list); \ + typeof(*list) head = (*list); \ while ((*list)->next) \ (*list) = (*list)->next; \ (*list)->next = (item); \ @@ -40,7 +40,7 @@ if ((*list) == (item)) { \ (*list) = (item)->next; \ } else { \ - void *head = (*list); \ + typeof(*list) head = (*list); \ while ((*list)->next && (*list)->next != (item)) \ (*list) = (*list)->next; \ if ((*list)->next != NULL) { \ @@ -52,7 +52,7 @@ #define ISCSI_LIST_LENGTH(list,length) \ do { \ (length) = 0; \ - void *head = (*list); \ + typeof(*list) head = (*list); \ while ((*list)) { \ (*list) = (*list)->next; \ (length)++; \