list: list_del_from()
[ccan] / ccan / list / test / run.c
index 7c71e396ca36e8823435bf8b81d5e96d4e9b91dc..13a1da4198134d88cbeb56020c1ee9acd7cce24a 100644 (file)
@@ -101,21 +101,23 @@ int main(int argc, char *argv[])
        }
        ok1(i == 3);
 
        }
        ok1(i == 3);
 
-       /* Test list_for_each_safe and list_del. */
+       /* Test list_for_each_safe, list_del and list_del_from. */
        i = 0;
        list_for_each_safe(&parent.children, c, n, list) {
                switch (i++) {
                case 0:
        i = 0;
        list_for_each_safe(&parent.children, c, n, list) {
                switch (i++) {
                case 0:
-                       ok1(c == &c1);
+                       ok1(c == &c1);  
+                       list_del(&c->list);
                        break;
                case 1:
                        ok1(c == &c2);
                        break;
                case 1:
                        ok1(c == &c2);
+                       list_del_from(&parent.children, &c->list);
                        break;
                case 2:
                        ok1(c == &c3);
                        break;
                case 2:
                        ok1(c == &c3);
+                       list_del_from(&parent.children, &c->list);
                        break;
                }
                        break;
                }
-               list_del(&c->list);
                ok1(list_check(&parent.children, NULL));
                if (i > 2)
                        break;
                ok1(list_check(&parent.children, NULL));
                if (i > 2)
                        break;