diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-15 05:40:56 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-06-15 05:40:56 +0000 |
commit | d50dda8c3501af9d593cd11272a15b480864a01c (patch) | |
tree | 652da97787e8e86f876b647ca9dab4b6b64fe291 /networking | |
parent | 873b895d50d69a45b52bef85a8a4fb190f9c89ce (diff) | |
download | busybox-w32-d50dda8c3501af9d593cd11272a15b480864a01c.tar.gz busybox-w32-d50dda8c3501af9d593cd11272a15b480864a01c.tar.bz2 busybox-w32-d50dda8c3501af9d593cd11272a15b480864a01c.zip |
*: use llist_pop for traverse-and-free list operation
function old new delta
append_file_list_to_list 109 111 +2
udhcpc_main 2414 2413 -1
run_parts_main 325 324 -1
od_main 2324 2323 -1
getopt_main 709 707 -2
env_main 253 251 -2
sed_main 659 656 -3
ps_main 522 519 -3
traceroute_main 3960 3954 -6
sort_main 844 838 -6
diff_main 866 858 -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/10 up/down: 2/-33) Total: -31 bytes
Diffstat (limited to 'networking')
-rw-r--r-- | networking/traceroute.c | 10 | ||||
-rw-r--r-- | networking/udhcp/dhcpc.c | 3 | ||||
-rw-r--r-- | networking/wget.c | 3 |
3 files changed, 4 insertions, 12 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c index e9df27559..6a5373469 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -1001,17 +1001,11 @@ int traceroute_main(int argc, char **argv) | |||
1001 | 1001 | ||
1002 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE | 1002 | #if ENABLE_FEATURE_TRACEROUTE_SOURCE_ROUTE |
1003 | if (source_route_list) { | 1003 | if (source_route_list) { |
1004 | llist_t *l_sr; | 1004 | while (source_route_list) { |
1005 | |||
1006 | l_sr = source_route_list; | ||
1007 | while (l_sr) { | ||
1008 | if (lsrr >= NGATEWAYS) | 1005 | if (lsrr >= NGATEWAYS) |
1009 | bb_error_msg_and_die("no more than %d gateways", NGATEWAYS); | 1006 | bb_error_msg_and_die("no more than %d gateways", NGATEWAYS); |
1010 | getaddr(gwlist + lsrr, l_sr->data); | 1007 | getaddr(gwlist + lsrr, llist_pop(&source_route_list)); |
1011 | ++lsrr; | 1008 | ++lsrr; |
1012 | l_sr = l_sr->link; | ||
1013 | free(source_route_list); | ||
1014 | source_route_list = l_sr; | ||
1015 | } | 1009 | } |
1016 | optlen = (lsrr + 1) * sizeof(gwlist[0]); | 1010 | optlen = (lsrr + 1) * sizeof(gwlist[0]); |
1017 | } | 1011 | } |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 655d39fd2..5eb1ed5fd 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -259,12 +259,11 @@ int udhcpc_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
259 | if (opt & OPT_o) | 259 | if (opt & OPT_o) |
260 | client_config.no_default_options = 1; | 260 | client_config.no_default_options = 1; |
261 | while (list_O) { | 261 | while (list_O) { |
262 | int n = index_in_strings(dhcp_option_strings, list_O->data); | 262 | int n = index_in_strings(dhcp_option_strings, llist_pop(&list_O)); |
263 | if (n < 0) | 263 | if (n < 0) |
264 | bb_error_msg_and_die("unknown option '%s'", list_O->data); | 264 | bb_error_msg_and_die("unknown option '%s'", list_O->data); |
265 | n = dhcp_options[n].code; | 265 | n = dhcp_options[n].code; |
266 | client_config.opt_mask[n >> 3] |= 1 << (n & 7); | 266 | client_config.opt_mask[n >> 3] |= 1 << (n & 7); |
267 | list_O = list_O->link; | ||
268 | } | 267 | } |
269 | 268 | ||
270 | if (read_interface(client_config.interface, &client_config.ifindex, | 269 | if (read_interface(client_config.interface, &client_config.ifindex, |
diff --git a/networking/wget.c b/networking/wget.c index 84ee1ca3e..7198197dd 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -469,8 +469,7 @@ int wget_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
469 | } | 469 | } |
470 | extra_headers = cp = xmalloc(size); | 470 | extra_headers = cp = xmalloc(size); |
471 | while (headers_llist) { | 471 | while (headers_llist) { |
472 | cp += sprintf(cp, "%s\r\n", headers_llist->data); | 472 | cp += sprintf(cp, "%s\r\n", (char*)llist_pop(&headers_llist)); |
473 | headers_llist = headers_llist->link; | ||
474 | } | 473 | } |
475 | } | 474 | } |
476 | #endif | 475 | #endif |