mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
We do not call malloc/free any more
This commit is contained in:
@@ -11,7 +11,4 @@ extern uint64_t nbSectionsToAssign;
|
||||
// Assigns all sections a slice of the address space
|
||||
void assign_AssignSections();
|
||||
|
||||
// `free`s all assignment memory that was allocated
|
||||
void assign_Cleanup();
|
||||
|
||||
#endif // RGBDS_LINK_ASSIGN_H
|
||||
|
||||
@@ -28,9 +28,4 @@ void obj_CheckAssertions();
|
||||
*/
|
||||
void obj_Setup(unsigned int nbFiles);
|
||||
|
||||
/*
|
||||
* `free`s all object memory that was allocated.
|
||||
*/
|
||||
void obj_Cleanup();
|
||||
|
||||
#endif // RGBDS_LINK_OBJECT_H
|
||||
|
||||
@@ -342,6 +342,19 @@ next:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static void freeSection(Section *section)
|
||||
{
|
||||
for (Section *next; section; section = next) {
|
||||
next = section->nextu;
|
||||
delete section;
|
||||
};
|
||||
}
|
||||
|
||||
static void freeSections()
|
||||
{
|
||||
sect_ForEach(freeSection);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Parse options
|
||||
@@ -447,7 +460,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Do cleanup before quitting, though.
|
||||
// Mostly here to please tools such as `valgrind` so actual errors can be seen
|
||||
atexit(obj_Cleanup);
|
||||
atexit(freeSections);
|
||||
|
||||
// Read all object files first,
|
||||
for (obj_Setup(argc - curArgIndex); curArgIndex < argc; curArgIndex++)
|
||||
|
||||
@@ -539,16 +539,3 @@ void obj_Setup(unsigned int nbFiles)
|
||||
{
|
||||
nodes.resize(nbFiles);
|
||||
}
|
||||
|
||||
static void freeSection(Section *section)
|
||||
{
|
||||
for (Section *next; section; section = next) {
|
||||
next = section->nextu;
|
||||
delete section;
|
||||
};
|
||||
}
|
||||
|
||||
void obj_Cleanup()
|
||||
{
|
||||
sect_ForEach(freeSection);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,6 @@ static int32_t computeRPNExpr(Patch const *patch, std::vector<Symbol> const &fil
|
||||
case RPN_BANK_SECT:
|
||||
// `expression` is not guaranteed to be '\0'-terminated. If it is not,
|
||||
// `getRPNByte` will have a fatal internal error.
|
||||
// In either case, `getRPNByte` will not free `expression`.
|
||||
name = (char const *)expression;
|
||||
while (getRPNByte(&expression, &size, patch->src, patch->lineNo))
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user