X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=tests%2Fopkg_active_list_test.c;h=f7bd390e181b9ffd68d8e644f1a548fbea2ee021;hp=ec6bec1d7ebace960e9a44f72fc43d2e309d32f0;hb=32ee5d15aca5dcdae46084c4a07fb7a072af379a;hpb=c4ec4181cf4dc98c580213ef302f4b9faa655592 diff --git a/tests/opkg_active_list_test.c b/tests/opkg_active_list_test.c index ec6bec1..f7bd390 100644 --- a/tests/opkg_active_list_test.c +++ b/tests/opkg_active_list_test.c @@ -1,23 +1,30 @@ +/* opkg_active_list.c - the opkg package management system -/* -.--A---B----C----D-----E----F - | |__k---L - | |_ N - |__ G ---H ---I---J - |_M |_O + Tick Chen -Then the sequence will be -G M H I O J A B K N L C D E F + Copyright (C) 2008 Openmoko + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. */ + #include #include +#include #include struct active_test { char *str; struct active_list list; -} __attribute__((packed)); +}; struct active_test *active_test_new(char *str) { struct active_test *ans = (struct active_test *)calloc(1, sizeof(struct active_test)); @@ -33,6 +40,16 @@ void active_test_add_depend(struct active_test *A, struct active_test *B) { active_list_add_depend(&A->list, &B->list); } +/* +.--A---B----C----D-----E----F + | |__k---L + | |_ N + |__ G ---H ---I---J + |_M |_O + +Then the sequence will be +G M H I O J A B K N L C D E F +*/ void make_list(struct active_list *head) { struct active_test *A = active_test_new("A"); struct active_test *B = active_test_new("B"); @@ -93,7 +110,7 @@ int main (void) { printf ("%s ",test->str); } printf("\n"); - for(ptr = active_list_next(&head, &head); ptr ;ptr = active_list_next(&head, ptr)) { + 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); }