summaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-06-15 05:40:56 +0000
committerDenis Vlasenko2008-06-15 05:40:56 +0000
commitd50dda8c3501af9d593cd11272a15b480864a01c (patch)
tree652da97787e8e86f876b647ca9dab4b6b64fe291 /editors/sed.c
parent873b895d50d69a45b52bef85a8a4fb190f9c89ce (diff)
downloadbusybox-d50dda8c3501af9d593cd11272a15b480864a01c.zip
busybox-d50dda8c3501af9d593cd11272a15b480864a01c.tar.gz
*: 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 'editors/sed.c')
-rw-r--r--editors/sed.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 817840d..bf01fc6 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1267,21 +1267,17 @@ int sed_main(int argc ATTRIBUTE_UNUSED, char **argv)
if (opt & 0x2) G.regex_type |= REG_EXTENDED; // -r
//if (opt & 0x4) G.be_quiet++; // -n
while (opt_e) { // -e
- add_cmd_block(opt_e->data);
- opt_e = opt_e->link;
- /* we leak opt_e here... */
+ add_cmd_block(llist_pop(&opt_e));
}
while (opt_f) { // -f
char *line;
FILE *cmdfile;
- cmdfile = xfopen(opt_f->data, "r");
+ cmdfile = xfopen(llist_pop(&opt_f), "r");
while ((line = xmalloc_fgetline(cmdfile)) != NULL) {
add_cmd(line);
free(line);
}
fclose(cmdfile);
- opt_f = opt_f->link;
- /* we leak opt_f here... */
}
/* if we didn't get a pattern from -e or -f, use argv[0] */
if (!(opt & 0x18)) {