X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fllist.c;h=8a74832ee3ff54e50d08c4e86f0c1daefbf0965e;hb=966ec7c067d7a2df5232a69c8d3d2e777347a62d;hp=8bf89a5950bf7188c28a5537f81ffe29ea515ad0;hpb=7d219aab70e6951ab82c27c202cac05016696723;p=oweals%2Fbusybox.git diff --git a/libbb/llist.c b/libbb/llist.c index 8bf89a595..8a74832ee 100644 --- a/libbb/llist.c +++ b/libbb/llist.c @@ -62,3 +62,17 @@ void llist_free(llist_t *elm, void (*freeit)(void *data)) if (freeit) freeit(data); } } + +/* Reverse list order. Useful since getopt32 saves option params + * in reverse order */ +llist_t* rev_llist(llist_t *list) +{ + llist_t *new = NULL; + while (list) { + llist_t *next = list->link; + list->link = new; + new = list; + list = next; + } + return new; +}