summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2016-09-05 22:51:02 -0400
committerTavian Barnes <tavianator@tavianator.com>2016-09-05 22:51:02 -0400
commitac16d6a9faaa4cdc38608dec6a855835a2580ebb (patch)
tree2ce5fa19e9fd690860f36d826184d2acbb49f8ac /parse.c
parent8f93c9bc59781061eeb3fcdacd8d6dbb992763d9 (diff)
downloadbfs-ac16d6a9faaa4cdc38608dec6a855835a2580ebb.tar.xz
Use the two-star list augmenting method.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c12
1 files changed, 4 insertions, 8 deletions
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,