From: Jo-Philipp Wich Date: Wed, 15 Mar 2017 00:32:52 +0000 (+0100) Subject: opkg_active_list_test: mark functions static, swap strcmp() with memcmp() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cfe46c7d5787df0bd643d44e8f985107b562300e;p=oweals%2Fopkg-lede.git opkg_active_list_test: mark functions static, swap strcmp() with memcmp() Signed-off-by: Jo-Philipp Wich --- diff --git a/tests/opkg_active_list_test.c b/tests/opkg_active_list_test.c index ad964dc..20e3eff 100644 --- a/tests/opkg_active_list_test.c +++ b/tests/opkg_active_list_test.c @@ -25,7 +25,7 @@ struct active_test { struct active_list list; }; -struct active_test *active_test_new(char *str) +static struct active_test *active_test_new(char *str) { struct active_test *ans = (struct active_test *)calloc(1, sizeof(struct active_test)); @@ -34,12 +34,12 @@ struct active_test *active_test_new(char *str) return ans; } -void active_test_add(struct active_list *head, struct active_test *node) +static void active_test_add(struct active_list *head, struct active_test *node) { active_list_add(head, &node->list); } -void active_test_add_depend(struct active_test *A, struct active_test *B) +static void active_test_add_depend(struct active_test *A, struct active_test *B) { active_list_add_depend(&A->list, &B->list); } @@ -55,7 +55,7 @@ Then the sequence will be +: G M H I O J A B K N L C D E F -: F E D C L N K B A J O I H M G */ -void make_list(struct active_list *head) +static void make_list(struct active_list *head) { struct active_test *A = active_test_new("A"); struct active_test *B = active_test_new("B"); @@ -99,15 +99,16 @@ void make_list(struct active_list *head) active_test_add_depend(L, N); } -int active_test_compare(const void *a, const void *b) +static int active_test_compare(const void *a, const void *b) { struct active_list *first = (struct active_list *)a; struct active_list *second = (struct active_list *)b; - return strcmp(list_entry(first, struct active_test, list), - list_entry(second, struct active_test, list)); + return memcmp(list_entry(first, struct active_test, list), + list_entry(second, struct active_test, list), + sizeof(struct active_test)); } -void show_list(struct active_list *head) +static void show_list(struct active_list *head) { struct active_list *ptr; struct active_test *test;