mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Make sectionMap not extern
This commit is contained in:
@@ -50,7 +50,6 @@ struct SectionSpec {
|
||||
};
|
||||
|
||||
extern std::deque<Section> sectionList;
|
||||
extern std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
|
||||
extern Section *currentSection;
|
||||
|
||||
Section *sect_FindSectionByName(std::string const &name);
|
||||
|
||||
@@ -66,15 +66,13 @@ static uint32_t getSectIDIfAny(Section *sect) {
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
// Search in `sectionList` instead of `sectionMap`, since section fragments share the
|
||||
// same name but have different IDs
|
||||
// Section fragments share the same name but have different IDs, so search by identity
|
||||
if (auto search =
|
||||
std::find_if(RANGE(sectionList), [§](Section const &s) { return &s == sect; });
|
||||
search != sectionList.end()) {
|
||||
return static_cast<uint32_t>(std::distance(sectionList.begin(), search));
|
||||
}
|
||||
|
||||
// Every section that exists should be in `sectionMap`
|
||||
fatal("Unknown section '%s'", sect->name.c_str()); // LCOV_EXCL_LINE
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ struct SectionStackEntry {
|
||||
std::stack<UnionStackEntry> unionStack;
|
||||
};
|
||||
|
||||
std::deque<Section> sectionList;
|
||||
std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
|
||||
Section *currentSection = nullptr;
|
||||
std::deque<Section> sectionList;
|
||||
static std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
|
||||
|
||||
static uint32_t curOffset; // Offset into the current section (see `sect_GetSymbolOffset`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user