*: 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
diff --git a/archival/tar.c b/archival/tar.c
index 64a4e35..0162e06 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -659,16 +659,11 @@
static llist_t *append_file_list_to_list(llist_t *list)
{
FILE *src_stream;
- llist_t *cur = list;
- llist_t *tmp;
char *line;
llist_t *newlist = NULL;
- while (cur) {
- src_stream = xfopen(cur->data, "r");
- tmp = cur;
- cur = cur->link;
- free(tmp);
+ while (list) {
+ src_stream = xfopen(llist_pop(&list), "r");
while ((line = xmalloc_fgetline(src_stream)) != NULL) {
/* kill trailing '/' unless the string is just "/" */
char *cp = last_char_is(line, '/');