From d7d33f2a6f135d3e8c948726f97bb6d9fab3e781 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 16 Nov 2008 10:25:16 +0000 Subject: [PATCH] Slightly simplify daisy chaining gotos. [r23704] --- parser.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/parser.c b/parser.c index 2a05c7b..417b1e2 100644 --- a/parser.c +++ b/parser.c @@ -118,7 +118,7 @@ static statement_t *current_parent = NULL; static ms_try_statement_t *current_try = NULL; static linkage_kind_t current_linkage = LINKAGE_INVALID; static goto_statement_t *goto_first = NULL; -static goto_statement_t *goto_last = NULL; +static goto_statement_t **goto_anchor = NULL; static label_statement_t *label_first = NULL; static label_statement_t **label_anchor = NULL; /** current translation unit. */ @@ -5272,8 +5272,8 @@ static void check_labels(void) "label '%Y' used but not defined", label->base.symbol); } } - goto_first = NULL; - goto_last = NULL; + goto_first = NULL; + goto_anchor = &goto_first; if (warning.unused_label) { for (const label_statement_t *label_statement = label_first; @@ -9841,12 +9841,8 @@ static statement_t *parse_goto(void) } /* remember the goto's in a list for later checking */ - if (goto_last == NULL) { - goto_first = &statement->gotos; - } else { - goto_last->next = &statement->gotos; - } - goto_last = &statement->gotos; + *goto_anchor = &statement->gotos; + goto_anchor = &statement->gotos.next; expect(';'); -- 2.20.1