mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Use a Defer struct to close files and restore lexer state with RAII (#1379)
This commit is contained in:
@@ -797,6 +797,10 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
||||
}
|
||||
}
|
||||
|
||||
#undef expectEol
|
||||
#undef expectToken
|
||||
#undef getToken
|
||||
|
||||
if (!data.empty())
|
||||
warning(&where, lineNo, "Last 'T' line had no 'R' line (ignored)");
|
||||
if (fileSections.size() < expectedNbAreas)
|
||||
@@ -841,10 +845,4 @@ void sdobj_ReadFile(FileStackNode const &where, FILE *file, std::vector<Symbol>
|
||||
// Calling `sect_AddSection` invalidates the contents of `fileSections`!
|
||||
sect_AddSection(std::move(section));
|
||||
}
|
||||
|
||||
#undef expectEol
|
||||
#undef expectToken
|
||||
#undef getToken
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user