From ac16d6a9faaa4cdc38608dec6a855835a2580ebb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 5 Sep 2016 22:51:02 -0400 Subject: Use the two-star list augmenting method. --- parse.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index f4491e9..15e0213 100644 --- a/parse.c +++ b/parse.c @@ -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, -- cgit v1.2.3