Use std::unique_ptr for rgblink sections (#1337)

This commit is contained in:
Sylvie
2024-03-09 11:12:01 -05:00
committed by GitHub
parent 9890cf25b4
commit 4a7d333891
9 changed files with 102 additions and 114 deletions

View File

@@ -346,19 +346,6 @@ next:
exit(1);
}
static void freeSection(Section &section) {
Section *next = &section;
for (Section *nextu; next; next = nextu) {
nextu = next->nextu;
delete next;
};
}
static void freeSections() {
sect_ForEach(freeSection);
}
int main(int argc, char *argv[]) {
// Parse options
for (int ch; (ch = musl_getopt_long_only(argc, argv, optstring, longopts, nullptr)) != -1;) {
@@ -462,10 +449,6 @@ int main(int argc, char *argv[]) {
if (isDmgMode)
sectionTypeInfo[SECTTYPE_VRAM].lastBank = 0;
// Do cleanup before quitting, though.
// Mostly here to please tools such as `valgrind` so actual errors can be seen
atexit(freeSections);
// Read all object files first,
for (obj_Setup(argc - curArgIndex); curArgIndex < argc; curArgIndex++)
obj_ReadFile(argv[curArgIndex], argc - curArgIndex - 1);