r4859 - in trunk/src/target/opkg: libopkg tests
tick at docs.openmoko.org
tick at docs.openmoko.org
Mon Dec 8 16:26:12 CET 2008
Author: tick
Date: 2008-12-08 16:26:11 +0100 (Mon, 08 Dec 2008)
New Revision: 4859
Modified:
trunk/src/target/opkg/libopkg/active_list.c
trunk/src/target/opkg/tests/opkg_active_list_test.c
Log:
opkg: implment active_list_clear()
Modified: trunk/src/target/opkg/libopkg/active_list.c
===================================================================
--- trunk/src/target/opkg/libopkg/active_list.c 2008-12-08 13:16:45 UTC (rev 4858)
+++ trunk/src/target/opkg/libopkg/active_list.c 2008-12-08 15:26:11 UTC (rev 4859)
@@ -71,7 +71,22 @@
return prev;
}
+static void list_head_clear (struct list_head *head) {
+ struct active_list *next;
+ struct list_head *n, *ptr;
+ if (!head)
+ return;
+ list_for_each_safe(ptr, n , head) {
+ next = list_entry(ptr, struct active_list, node);
+ if (next->depend.next != &next->depend) {
+ list_head_clear(&next->depend);
+ }
+ list_del_init(&next->node);
+ next->depended = NULL;
+ }
+}
void active_list_clear(struct active_list *head) {
+ list_head_clear(&head->node);
}
void active_list_add_depend(struct active_list *node, struct active_list *depend) {
Modified: trunk/src/target/opkg/tests/opkg_active_list_test.c
===================================================================
--- trunk/src/target/opkg/tests/opkg_active_list_test.c 2008-12-08 13:16:45 UTC (rev 4858)
+++ trunk/src/target/opkg/tests/opkg_active_list_test.c 2008-12-08 15:26:11 UTC (rev 4859)
@@ -111,7 +111,8 @@
test = list_entry(ptr, struct active_test, list);
printf ("%s ",test->str);
}
- printf("\npos order: ");
+ printf("\nafter clear: ");
+ active_list_clear(&head);
for(ptr = active_list_next(&head, NULL); ptr ;ptr = active_list_next(&head, ptr)) {
test = list_entry(ptr, struct active_test, list);
printf ("%s ",test->str);
More information about the commitlog
mailing list