mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 05:54:08 +00:00
include: add list_last_entry to get the tail of a list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
@@ -103,14 +103,20 @@ test_list_append(void)
|
||||
|
||||
c = list_first_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
|
||||
c = list_last_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
|
||||
|
||||
list_append(&child[1].node, &parent.children);
|
||||
c = list_first_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
|
||||
c = list_last_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
|
||||
|
||||
list_append(&child[2].node, &parent.children);
|
||||
c = list_first_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
|
||||
c = list_last_entry(&parent.children, struct child, node);
|
||||
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
|
||||
|
||||
i = 0;
|
||||
list_for_each_entry(c, &parent.children, node) {
|
||||
|
||||
Reference in New Issue
Block a user