aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_container_dll.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_container_dll.c')
-rw-r--r--src/util/test_container_dll.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/util/test_container_dll.c b/src/util/test_container_dll.c
index 7203cde22..b5c238511 100644
--- a/src/util/test_container_dll.c
+++ b/src/util/test_container_dll.c
@@ -30,7 +30,8 @@
30/** 30/**
31 * Element in the DLL. 31 * Element in the DLL.
32 */ 32 */
33struct Element { 33struct Element
34{
34 /** 35 /**
35 * Required pointer to previous element. 36 * Required pointer to previous element.
36 */ 37 */
@@ -57,9 +58,9 @@ struct Element {
57 * @return #GNUNET_YES if @e1 < @e2, otherwise #GNUNET_NO 58 * @return #GNUNET_YES if @e1 < @e2, otherwise #GNUNET_NO
58 */ 59 */
59static int 60static int
60cmp_elem(void *cls, 61cmp_elem (void *cls,
61 struct Element *e1, 62 struct Element *e1,
62 struct Element *e2) 63 struct Element *e2)
63{ 64{
64 if (e1->value == e2->value) 65 if (e1->value == e2->value)
65 return 0; 66 return 0;
@@ -68,7 +69,7 @@ cmp_elem(void *cls,
68 69
69 70
70int 71int
71main(int argc, char **argv) 72main (int argc, char **argv)
72{ 73{
73 unsigned int values[] = { 74 unsigned int values[] = {
74 4, 5, 8, 6, 9, 3, 7, 2, 1, 0 75 4, 5, 8, 6, 9, 3, 7, 2, 1, 0
@@ -78,33 +79,33 @@ main(int argc, char **argv)
78 struct Element *e; 79 struct Element *e;
79 unsigned int want; 80 unsigned int want;
80 81
81 GNUNET_log_setup("test-container-dll", 82 GNUNET_log_setup ("test-container-dll",
82 "WARNING", 83 "WARNING",
83 NULL); 84 NULL);
84 for (unsigned int off = 0; 85 for (unsigned int off = 0;
85 0 != values[off]; 86 0 != values[off];
86 off++) 87 off++)
87 { 88 {
88 e = GNUNET_new(struct Element); 89 e = GNUNET_new (struct Element);
89 e->value = values[off]; 90 e->value = values[off];
90 GNUNET_CONTAINER_DLL_insert_sorted(struct Element, 91 GNUNET_CONTAINER_DLL_insert_sorted (struct Element,
91 cmp_elem, 92 cmp_elem,
92 NULL, 93 NULL,
93 head, 94 head,
94 tail, 95 tail,
95 e); 96 e);
96 } 97 }
97 98
98 want = 1; 99 want = 1;
99 while (NULL != (e = head)) 100 while (NULL != (e = head))
100 { 101 {
101 GNUNET_assert(e->value == want); 102 GNUNET_assert (e->value == want);
102 GNUNET_CONTAINER_DLL_remove(head, 103 GNUNET_CONTAINER_DLL_remove (head,
103 tail, 104 tail,
104 e); 105 e);
105 GNUNET_free(e); 106 GNUNET_free (e);
106 want++; 107 want++;
107 } 108 }
108 return 0; 109 return 0;
109} 110}
110 111