summaryrefslogtreecommitdiff
path: root/src/test/test-list.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-14 06:10:14 +0200
committerLennart Poettering <lennart@poettering.net>2013-10-14 06:11:19 +0200
commit71fda00f320379f5cbee8e118848de98caaa229d (patch)
tree00a913086d70abadb1185e1343d97df860b0d612 /src/test/test-list.c
parent14bf2c9d375db6a4670bc0ef0e521e35a939a498 (diff)
list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
Diffstat (limited to 'src/test/test-list.c')
-rw-r--r--src/test/test-list.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/test/test-list.c b/src/test/test-list.c
index 271050476..fa52ad1db 100644
--- a/src/test/test-list.c
+++ b/src/test/test-list.c
@@ -29,13 +29,13 @@ int main(int argc, const char *argv[]) {
list_item items[4];
list_item *cursor;
- LIST_HEAD_INIT(list_item, head);
+ LIST_HEAD_INIT(head);
assert_se(head == NULL);
for (i = 0; i < ELEMENTSOF(items); i++) {
- LIST_INIT(list_item, item, &items[i]);
+ LIST_INIT(item, &items[i]);
assert_se(LIST_JUST_US(item, &items[i]));
- LIST_PREPEND(list_item, item, head, &items[i]);
+ LIST_PREPEND(item, head, &items[i]);
}
assert_se(!LIST_JUST_US(item, head));
@@ -50,13 +50,13 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_FIND_HEAD(list_item, item, &items[0], cursor);
+ LIST_FIND_HEAD(item, &items[0], cursor);
assert_se(cursor == &items[3]);
- LIST_FIND_TAIL(list_item, item, &items[3], cursor);
+ LIST_FIND_TAIL(item, &items[3], cursor);
assert_se(cursor == &items[0]);
- LIST_REMOVE(list_item, item, head, &items[1]);
+ LIST_REMOVE(item, head, &items[1]);
assert_se(LIST_JUST_US(item, &items[1]));
assert_se(items[0].item_next == NULL);
@@ -67,7 +67,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_INSERT_AFTER(list_item, item, head, &items[3], &items[1]);
+ LIST_INSERT_AFTER(item, head, &items[3], &items[1]);
assert_se(items[0].item_next == NULL);
assert_se(items[2].item_next == &items[0]);
assert_se(items[1].item_next == &items[2]);
@@ -78,7 +78,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[1].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[0]);
+ LIST_REMOVE(item, head, &items[0]);
assert_se(LIST_JUST_US(item, &items[0]));
assert_se(items[2].item_next == NULL);
@@ -89,7 +89,7 @@ int main(int argc, const char *argv[]) {
assert_se(items[1].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[1]);
+ LIST_REMOVE(item, head, &items[1]);
assert_se(LIST_JUST_US(item, &items[1]));
assert_se(items[2].item_next == NULL);
@@ -98,11 +98,11 @@ int main(int argc, const char *argv[]) {
assert_se(items[2].item_prev == &items[3]);
assert_se(items[3].item_prev == NULL);
- LIST_REMOVE(list_item, item, head, &items[2]);
+ LIST_REMOVE(item, head, &items[2]);
assert_se(LIST_JUST_US(item, &items[2]));
assert_se(LIST_JUST_US(item, head));
- LIST_REMOVE(list_item, item, head, &items[3]);
+ LIST_REMOVE(item, head, &items[3]);
assert_se(LIST_JUST_US(item, &items[3]));
return 0;