projects
/
platform
/
upstream
/
kmscon.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b8f58fe
)
shl: dlist: add _first/_last helpers
author
David Herrmann
<dh.herrmann@gmail.com>
Tue, 5 Mar 2013 00:22:13 +0000
(
01:22
+0100)
committer
David Herrmann
<dh.herrmann@gmail.com>
Tue, 5 Mar 2013 00:22:13 +0000
(
01:22
+0100)
These helpers return the first and last elements respectively.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
src/shl_dlist.h
patch
|
blob
|
history
diff --git
a/src/shl_dlist.h
b/src/shl_dlist.h
index
c1d4beb
..
9e30dc5
100644
(file)
--- a/
src/shl_dlist.h
+++ b/
src/shl_dlist.h
@@
-102,6
+102,12
@@
static inline bool shl_dlist_empty(struct shl_dlist *head)
#define shl_dlist_entry(ptr, type, member) \
shl_offsetof((ptr), type, member)
+#define shl_dlist_first(head, type, member) \
+ shl_dlist_entry((head)->next, type, member)
+
+#define shl_dlist_last(head, type, member) \
+ shl_dlist_entry((head)->prev, type, member)
+
#define shl_dlist_for_each(iter, head) \
for (iter = (head)->next; iter != (head); iter = iter->next)