slist: Clean up the slist.h header file
Fix indentation, align backslashes, surround multiline macros with
do { } while (0) and remove the unused ISCSI_LIST_LENGTH() macro.
This commit is contained in:
@@ -18,46 +18,39 @@
|
|||||||
#ifndef __iscsi_slist_h__
|
#ifndef __iscsi_slist_h__
|
||||||
#define __iscsi_slist_h__
|
#define __iscsi_slist_h__
|
||||||
|
|
||||||
#define ISCSI_LIST_ADD(list, item) \
|
#define ISCSI_LIST_ADD(list, item) \
|
||||||
do { \
|
do { \
|
||||||
(item)->next = (*list); \
|
(item)->next = (*list); \
|
||||||
(*list) = (item); \
|
(*list) = (item); \
|
||||||
} while (0);
|
} while (0)
|
||||||
|
|
||||||
#define ISCSI_LIST_ADD_END(list, item) \
|
#define ISCSI_LIST_ADD_END(list, item) \
|
||||||
if ((*list) == NULL) { \
|
do { \
|
||||||
ISCSI_LIST_ADD((list), (item)); \
|
if ((*list) == NULL) { \
|
||||||
} else { \
|
ISCSI_LIST_ADD((list), (item)); \
|
||||||
typeof(*list) head = (*list); \
|
} else { \
|
||||||
while ((*list)->next) \
|
typeof(*list) head = (*list); \
|
||||||
(*list) = (*list)->next; \
|
while ((*list)->next) \
|
||||||
(*list)->next = (item); \
|
(*list) = (*list)->next; \
|
||||||
(item)->next = NULL; \
|
(*list)->next = (item); \
|
||||||
(*list) = head; \
|
(item)->next = NULL; \
|
||||||
}
|
(*list) = head; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define ISCSI_LIST_REMOVE(list, item) \
|
#define ISCSI_LIST_REMOVE(list, item) \
|
||||||
if ((*list) == (item)) { \
|
do { \
|
||||||
(*list) = (item)->next; \
|
if ((*list) == (item)) { \
|
||||||
} else { \
|
(*list) = (item)->next; \
|
||||||
typeof(*list) head = (*list); \
|
} else { \
|
||||||
while ((*list)->next && (*list)->next != (item)) \
|
typeof(*list) head = (*list); \
|
||||||
(*list) = (*list)->next; \
|
while ((*list)->next && (*list)->next != (item)) \
|
||||||
if ((*list)->next != NULL) { \
|
(*list) = (*list)->next; \
|
||||||
(*list)->next = (*list)->next->next; \
|
if ((*list)->next != NULL) { \
|
||||||
} \
|
(*list)->next = (*list)->next->next; \
|
||||||
(*list) = head; \
|
} \
|
||||||
}
|
(*list) = head; \
|
||||||
|
} \
|
||||||
#define ISCSI_LIST_LENGTH(list,length) \
|
} while (0)
|
||||||
do { \
|
|
||||||
(length) = 0; \
|
|
||||||
typeof(*list) head = (*list); \
|
|
||||||
while ((*list)) { \
|
|
||||||
(*list) = (*list)->next; \
|
|
||||||
(length)++; \
|
|
||||||
} \
|
|
||||||
(*list) = head; \
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
#endif /* __iscsi_slist_h__ */
|
#endif /* __iscsi_slist_h__ */
|
||||||
|
|||||||
Reference in New Issue
Block a user