summaryrefslogtreecommitdiff
path: root/src/basic/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/list.h')
-rw-r--r--src/basic/list.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/basic/list.h b/src/basic/list.h
index 643e0bea88..f7f97000e0 100644
--- a/src/basic/list.h
+++ b/src/basic/list.h
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
+#include "macro.h"
+
/* The head of the linked list. Use this in the structure that shall
* contain the head of the linked list */
#define LIST_HEAD(t,name) \
@@ -13,8 +15,8 @@
/* Initialize the list's head */
#define LIST_HEAD_INIT(head) \
do { \
- (head) = NULL; } \
- while (false)
+ (head) = NULL; \
+ } while (false)
/* Initialize a list item */
#define LIST_INIT(name,item) \
@@ -38,9 +40,9 @@
/* Append an item to the list */
#define LIST_APPEND(name,head,item) \
do { \
- typeof(*(head)) *_tail; \
- LIST_FIND_TAIL(name,head,_tail); \
- LIST_INSERT_AFTER(name,head,_tail,item); \
+ typeof(*(head)) **_hhead = &(head), *_tail; \
+ LIST_FIND_TAIL(name, *_hhead, _tail); \
+ LIST_INSERT_AFTER(name, *_hhead, _tail, item); \
} while (false)
/* Remove an item from the list */