From 4a73eb56eaa43800f80bdc8f3394c1243ba9abc7 Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 17 Aug 2021 18:43:25 -0400 Subject: [PATCH] Make `peek()` tail recursive instead of using `goto` Compilation is identical with `gcc` or `clang`, -O3` or `-O2` --- src/asm/lexer.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/asm/lexer.c b/src/asm/lexer.c index 4d80f4dd..6832ecfc 100644 --- a/src/asm/lexer.c +++ b/src/asm/lexer.c @@ -900,10 +900,7 @@ static char const *readInterpolation(size_t depth); static int peek(void) { - int c; - -restart: - c = peekInternal(0); + int c = peekInternal(0); if (lexerState->macroArgScanDistance > 0) return c; @@ -924,7 +921,7 @@ restart: * expanded, so skip it and keep peeking. */ if (!str || !str[0]) - goto restart; + return peek(); beginExpansion(str, c == '#', NULL); @@ -945,7 +942,7 @@ restart: if (str && str[0]) beginExpansion(str, false, str); - goto restart; + return peek(); } return c;