diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-08 15:08:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-08 15:08:42 +0000 |
commit | 8d9f495d68664017e0b87f2c0c2d0eae9f3c4836 (patch) | |
tree | 157087760d624a657c3ce11b142afb1c72bf225a /libbb | |
parent | b04b4357ff5a5b5194a7ff3c875d8746fac9ff33 (diff) | |
download | busybox-w32-8d9f495d68664017e0b87f2c0c2d0eae9f3c4836.tar.gz busybox-w32-8d9f495d68664017e0b87f2c0c2d0eae9f3c4836.tar.bz2 busybox-w32-8d9f495d68664017e0b87f2c0c2d0eae9f3c4836.zip |
getopt32: fix llist_t options ordering. llist_rev is not unused.
function old new delta
tar_main 705 695 -10
sort_main 928 918 -10
decode_format_string 886 876 -10
run_parts_main 197 185 -12
ps_main 513 500 -13
wget_main 2764 2750 -14
awk_main 1014 1000 -14
od_main 2886 2866 -20
llist_rev 25 - -25
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/8 up/down: 0/-128) Total: -128 bytes
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/getopt32.c | 4 | ||||
-rw-r--r-- | libbb/llist.c | 23 |
2 files changed, 14 insertions, 13 deletions
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index 6cdbfd35d..dec97d743 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
@@ -242,7 +242,7 @@ Special characters: | |||
242 | llist_t *patterns = NULL; | 242 | llist_t *patterns = NULL; |
243 | 243 | ||
244 | (this pointer must be initializated to NULL if the list is empty | 244 | (this pointer must be initializated to NULL if the list is empty |
245 | as required by *llist_add_to(llist_t *old_head, char *new_item).) | 245 | as required by llist_add_to_end(llist_t **old_head, char *new_item).) |
246 | 246 | ||
247 | opt_complementary = "e::"; | 247 | opt_complementary = "e::"; |
248 | 248 | ||
@@ -487,7 +487,7 @@ getopt32(int argc, char **argv, const char *applet_opts, ...) | |||
487 | if (on_off->counter) | 487 | if (on_off->counter) |
488 | (*(on_off->counter))++; | 488 | (*(on_off->counter))++; |
489 | if (on_off->list_flg) { | 489 | if (on_off->list_flg) { |
490 | llist_add_to((llist_t **)(on_off->optarg), optarg); | 490 | llist_add_to_end((llist_t **)(on_off->optarg), optarg); |
491 | } else if (on_off->optarg) { | 491 | } else if (on_off->optarg) { |
492 | *(char **)(on_off->optarg) = optarg; | 492 | *(char **)(on_off->optarg) = optarg; |
493 | } | 493 | } |
diff --git a/libbb/llist.c b/libbb/llist.c index 2b34f762c..706751447 100644 --- a/libbb/llist.c +++ b/libbb/llist.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include "libbb.h" | 14 | #include "libbb.h" |
15 | 15 | ||
16 | /* Add data to the start of the linked list. */ | 16 | /* Add data to the start of the linked list. */ |
17 | void llist_add_to(llist_t ** old_head, void *data) | 17 | void llist_add_to(llist_t **old_head, void *data) |
18 | { | 18 | { |
19 | llist_t *new_head = xmalloc(sizeof(llist_t)); | 19 | llist_t *new_head = xmalloc(sizeof(llist_t)); |
20 | 20 | ||
@@ -24,7 +24,7 @@ void llist_add_to(llist_t ** old_head, void *data) | |||
24 | } | 24 | } |
25 | 25 | ||
26 | /* Add data to the end of the linked list. */ | 26 | /* Add data to the end of the linked list. */ |
27 | void llist_add_to_end(llist_t ** list_head, void *data) | 27 | void llist_add_to_end(llist_t **list_head, void *data) |
28 | { | 28 | { |
29 | llist_t *new_item = xmalloc(sizeof(llist_t)); | 29 | llist_t *new_item = xmalloc(sizeof(llist_t)); |
30 | 30 | ||
@@ -43,7 +43,7 @@ void llist_add_to_end(llist_t ** list_head, void *data) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* Remove first element from the list and return it */ | 45 | /* Remove first element from the list and return it */ |
46 | void *llist_pop(llist_t ** head) | 46 | void *llist_pop(llist_t **head) |
47 | { | 47 | { |
48 | void *data, *next; | 48 | void *data, *next; |
49 | 49 | ||
@@ -81,7 +81,7 @@ void llist_unlink(llist_t **head, llist_t *elm) | |||
81 | 81 | ||
82 | /* Recursively free all elements in the linked list. If freeit != NULL | 82 | /* Recursively free all elements in the linked list. If freeit != NULL |
83 | * call it on each datum in the list */ | 83 | * call it on each datum in the list */ |
84 | void llist_free(llist_t * elm, void (*freeit) (void *data)) | 84 | void llist_free(llist_t *elm, void (*freeit) (void *data)) |
85 | { | 85 | { |
86 | while (elm) { | 86 | while (elm) { |
87 | void *data = llist_pop(&elm); | 87 | void *data = llist_pop(&elm); |
@@ -91,18 +91,19 @@ void llist_free(llist_t * elm, void (*freeit) (void *data)) | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | /* Reverse list order. Useful since getopt32 saves option params | 94 | #ifdef UNUSED |
95 | * in reverse order */ | 95 | /* Reverse list order. */ |
96 | llist_t *llist_rev(llist_t * list) | 96 | llist_t *llist_rev(llist_t *list) |
97 | { | 97 | { |
98 | llist_t *new = NULL; | 98 | llist_t *rev = NULL; |
99 | 99 | ||
100 | while (list) { | 100 | while (list) { |
101 | llist_t *next = list->link; | 101 | llist_t *next = list->link; |
102 | 102 | ||
103 | list->link = new; | 103 | list->link = rev; |
104 | new = list; | 104 | rev = list; |
105 | list = next; | 105 | list = next; |
106 | } | 106 | } |
107 | return new; | 107 | return rev; |
108 | } | 108 | } |
109 | #endif | ||