mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Make peek() tail recursive instead of using goto
Compilation is identical with `gcc` or `clang`, -O3` or `-O2`
This commit is contained in:
@@ -900,10 +900,7 @@ static char const *readInterpolation(size_t depth);
|
|||||||
|
|
||||||
static int peek(void)
|
static int peek(void)
|
||||||
{
|
{
|
||||||
int c;
|
int c = peekInternal(0);
|
||||||
|
|
||||||
restart:
|
|
||||||
c = peekInternal(0);
|
|
||||||
|
|
||||||
if (lexerState->macroArgScanDistance > 0)
|
if (lexerState->macroArgScanDistance > 0)
|
||||||
return c;
|
return c;
|
||||||
@@ -924,7 +921,7 @@ restart:
|
|||||||
* expanded, so skip it and keep peeking.
|
* expanded, so skip it and keep peeking.
|
||||||
*/
|
*/
|
||||||
if (!str || !str[0])
|
if (!str || !str[0])
|
||||||
goto restart;
|
return peek();
|
||||||
|
|
||||||
beginExpansion(str, c == '#', NULL);
|
beginExpansion(str, c == '#', NULL);
|
||||||
|
|
||||||
@@ -945,7 +942,7 @@ restart:
|
|||||||
|
|
||||||
if (str && str[0])
|
if (str && str[0])
|
||||||
beginExpansion(str, false, str);
|
beginExpansion(str, false, str);
|
||||||
goto restart;
|
return peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|||||||
Reference in New Issue
Block a user