diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2016-09-05 22:51:02 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2016-09-05 22:51:02 -0400 |
commit | ac16d6a9faaa4cdc38608dec6a855835a2580ebb (patch) | |
tree | 2ce5fa19e9fd690860f36d826184d2acbb49f8ac /parse.c | |
parent | 8f93c9bc59781061eeb3fcdacd8d6dbb992763d9 (diff) | |
download | bfs-ac16d6a9faaa4cdc38608dec6a855835a2580ebb.tar.xz |
Use the two-star list augmenting method.
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -192,7 +192,7 @@ struct parser_state { /** The name of this program. */ const char *command; /** The current tail of the root path list. */ - struct root *roots_tail; + struct root **roots_tail; /** The optimization level. */ int optlevel; @@ -316,12 +316,8 @@ static bool parse_root(struct parser_state *state, const char *path) { root->path = path; root->next = NULL; - if (state->roots_tail) { - state->roots_tail->next = root; - } else { - state->cmdline->roots = root; - } - state->roots_tail = root; + *state->roots_tail = root; + state->roots_tail = &root->next; return true; } @@ -1937,7 +1933,7 @@ struct cmdline *parse_cmdline(int argc, char *argv[]) { .cmdline = cmdline, .argv = argv + 1, .command = argv[0], - .roots_tail = NULL, + .roots_tail = &cmdline->roots, .implicit_print = true, .warn = true, .non_option_seen = false, |