diff options
author | Rob Landley <rob@landley.net> | 2012-07-15 17:22:04 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-07-15 17:22:04 -0500 |
commit | 9e2b6db36ab6486172fccd0e1786532826d58c53 (patch) | |
tree | 8027567bf76e073ad13594d634e0268de6f83e05 /toys | |
parent | 2037b8396427ab82edd1912357e9177a2800b01a (diff) | |
download | toybox-9e2b6db36ab6486172fccd0e1786532826d58c53.tar.gz |
Genericize llist code a bit: rename llist_free() to llist_traverse(), and no longer accept NULL as a synonym for free.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/df.c | 2 | ||||
-rw-r--r-- | toys/patch.c | 6 | ||||
-rw-r--r-- | toys/tail.c | 4 | ||||
-rw-r--r-- | toys/toysh.c | 2 | ||||
-rw-r--r-- | toys/which.c | 2 |
5 files changed, 8 insertions, 8 deletions
@@ -150,5 +150,5 @@ void df_main(void) } } - if (CFG_TOYBOX_FREE) llist_free(mtlist, NULL); + if (CFG_TOYBOX_FREE) llist_traverse(mtlist, free); } diff --git a/toys/patch.c b/toys/patch.c index 95702ae6..647bb18f 100644 --- a/toys/patch.c +++ b/toys/patch.c @@ -108,7 +108,7 @@ static void fail_hunk(void) // this file and advance to next file. TT.state = 2; - llist_free(TT.current_hunk, do_line); + llist_traverse(TT.current_hunk, do_line); TT.current_hunk = NULL; delete_tempfile(TT.filein, TT.fileout, &TT.tempname); TT.state = 0; @@ -221,13 +221,13 @@ static int apply_one_hunk(void) out: // We have a match. Emit changed data. TT.state = "-+"[reverse]; - llist_free(TT.current_hunk, do_line); + llist_traverse(TT.current_hunk, do_line); TT.current_hunk = NULL; TT.state = 1; done: if (buf) { buf->prev->next = NULL; - llist_free(buf, do_line); + llist_traverse(buf, do_line); } return TT.state; diff --git a/toys/tail.c b/toys/tail.c index a029eca9..8783d6ba 100644 --- a/toys/tail.c +++ b/toys/tail.c @@ -130,7 +130,7 @@ static int try_lseek(int fd, long bytes, long lines) } // Output stored data - llist_free(list, dump_chunk); + llist_traverse(list, dump_chunk); // In case of -f lseek(fd, bytes, SEEK_SET); @@ -201,7 +201,7 @@ static void do_tail(int fd, char *name) } // Output/free the buffer. - llist_free(list, dump_chunk); + llist_traverse(list, dump_chunk); // Measuring from the beginning of the file. } else for (;;) { diff --git a/toys/toysh.c b/toys/toysh.c index 365c47fc..c2f494d3 100644 --- a/toys/toysh.c +++ b/toys/toysh.c @@ -342,7 +342,7 @@ static void handle(char *command) // Run those commands run_pipeline(&line); - llist_free(line.cmd, free_cmd); + llist_traverse(line.cmd, free_cmd); } } diff --git a/toys/which.c b/toys/which.c index 0ffc725a..4923859c 100644 --- a/toys/which.c +++ b/toys/which.c @@ -53,7 +53,7 @@ static int which_in_path(char *filename) puts(list->str); // If we should stop at one match, do so if (!toys.optflags) { - llist_free(list, NULL); + llist_traverse(list, free); break; } } |