Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Kopp
Ardix
Commits
b053cc32
Verified
Commit
b053cc32
authored
Aug 04, 2021
by
Felix Kopp
Browse files
list: fix list_for_each_entry_safe
parent
203c1678
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/ardix/list.h
View file @
b053cc32
...
...
@@ -3,6 +3,7 @@
#pragma once
#include <ardix/util.h>
#include <toolchain.h>
struct
list_head
{
struct
list_head
*
next
;
...
...
@@ -15,10 +16,11 @@ struct list_head {
.prev = &name, \
}
#define list_init(head) ({ \
(head)->next = head; \
(head)->prev = head; \
})
__always_inline
void
list_init
(
struct
list_head
*
head
)
{
head
->
prev
=
head
;
head
->
next
=
head
;
}
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
...
...
@@ -65,7 +67,7 @@ struct list_head {
#define list_for_each_entry_safe(head, cursor, tmp, member) \
for (cursor = list_first_entry(head, typeof(*(cursor)), member), \
tmp = list_next_entry(cursor, member); \
tmp != (head);
\
&(
tmp
)->member
!= (head); \
cursor = tmp, tmp = list_next_entry(tmp, member))
void
list_insert
(
struct
list_head
*
head
,
struct
list_head
*
new
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment