X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=blobdiff_plain;f=libopkg%2Factive_list.c;h=a7ce08e11958f391eecb8c4e6f0882e9b393d449;hp=ceac6e9f33e4ace4bb9e193a0e2f1d2004700e12;hb=23d31fbb7c6dee44226443c04f556c947f3985c1;hpb=7fe45f22f6292edfd7c7a3e834adaf32c18c9993 diff --git a/libopkg/active_list.c b/libopkg/active_list.c index ceac6e9..a7ce08e 100644 --- a/libopkg/active_list.c +++ b/libopkg/active_list.c @@ -137,43 +137,3 @@ void active_list_head_delete(struct active_list *head) active_list_clear(head); free(head); } - -/* - * Using insert sort. - * Note. the list should not be large, or it will be very inefficient. - * - */ -struct active_list *active_list_sort(struct active_list *head, - int (*compare) (const void *, - const void *)) -{ - struct active_list tmphead; - struct active_list *node, *ptr; - if (!head) - return NULL; - active_list_init(&tmphead); - for (node = active_list_next(head, NULL); node; - node = active_list_next(head, NULL)) { - if (tmphead.node.next == &tmphead.node) { - active_list_move_node(head, &tmphead, node); - } else { - for (ptr = active_list_next(&tmphead, NULL); ptr; - ptr = active_list_next(&tmphead, ptr)) { - if (compare(ptr, node) <= 0) { - break; - } - } - if (!ptr) { - active_list_move_node(head, &tmphead, node); - } else { - active_list_move_node(head, ptr, node); - } - } - node->depended = &tmphead; - } - for (ptr = active_list_prev(&tmphead, NULL); ptr; - ptr = active_list_prev(&tmphead, NULL)) { - active_list_move_node(&tmphead, head, ptr); - } - return head; -}