mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Use automatic allocation for section data
This commit is contained in:
@@ -286,13 +286,8 @@ static struct Section *createSection(char const *name, enum SectionType type,
|
||||
sect.alignOfs = alignOffset;
|
||||
|
||||
// It is only needed to allocate memory for ROM sections.
|
||||
if (sect_HasData(type)) {
|
||||
sect.data = (uint8_t *)malloc(sectionTypeInfo[type].size);
|
||||
if (sect.data == NULL)
|
||||
fatalerror("Not enough memory for section: %s\n", strerror(errno));
|
||||
} else {
|
||||
sect.data = NULL;
|
||||
}
|
||||
if (sect_HasData(type))
|
||||
sect.data.resize(sectionTypeInfo[type].size);
|
||||
|
||||
return §
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user