mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Avoid use of goto in nextLine
This commit is contained in:
@@ -34,9 +34,10 @@ static char const *delim = " \f\n\r\t\v"; // Whitespace according to the C and P
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
nextLine(std::vector<char> &lineBuf, uint32_t &lineNo, FileStackNode const &where, FILE *file) {
|
nextLine(std::vector<char> &lineBuf, uint32_t &lineNo, FileStackNode const &where, FILE *file) {
|
||||||
retry:
|
int firstChar;
|
||||||
|
for (;;) {
|
||||||
++lineNo;
|
++lineNo;
|
||||||
int firstChar = getc(file);
|
firstChar = getc(file);
|
||||||
lineBuf.clear();
|
lineBuf.clear();
|
||||||
|
|
||||||
switch (firstChar) {
|
switch (firstChar) {
|
||||||
@@ -55,7 +56,9 @@ retry:
|
|||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case '\n':
|
case '\n':
|
||||||
goto retry;
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
Reference in New Issue
Block a user