mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 18:52:07 +00:00
Use concrete types instead of auto when convenient and not redundant (#1757)
This commit is contained in:
@@ -351,9 +351,9 @@ static void categorizeSection(Section §ion) {
|
||||
}
|
||||
|
||||
std::deque<Section *> §ions = unassignedSections[constraints];
|
||||
auto pos = sections.begin();
|
||||
|
||||
// Insert section while keeping the list sorted by decreasing size
|
||||
auto pos = sections.begin();
|
||||
while (pos != sections.end() && (*pos)->size > section.size) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ void out_AddSection(Section const §ion) {
|
||||
std::deque<Section const *> &bankSections =
|
||||
section.size ? sections[section.type][targetBank].sections
|
||||
: sections[section.type][targetBank].zeroLenSections;
|
||||
auto pos = bankSections.begin();
|
||||
|
||||
// Insert section while keeping the list sorted by increasing org
|
||||
auto pos = bankSections.begin();
|
||||
while (pos != bankSections.end() && (*pos)->org < section.org) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
bankSections.insert(pos, §ion);
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ static void writeSymBank(SortedSections const &bankSections, SectionType type, u
|
||||
std::string parentName = sym->name.substr(0, pos);
|
||||
if (Symbol const *parentSym = sym_GetSymbol(parentName);
|
||||
parentSym && std::holds_alternative<Label>(parentSym->data)) {
|
||||
auto const &parentLabel = parentSym->label();
|
||||
Label const &parentLabel = parentSym->label();
|
||||
Section const &parentSection = *parentLabel.section;
|
||||
parentAddr = static_cast<uint16_t>(parentLabel.offset + parentSection.org);
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ void sdobj_ReadFile(FileStackNode const &src, FILE *file, std::vector<Symbol> &f
|
||||
|
||||
// RAM sections can have a size, but don't get any data (they shouldn't have any)
|
||||
if (section->type != SECTTYPE_INVALID) {
|
||||
auto const &typeInfo = sectionTypeInfo[section->type];
|
||||
SectionTypeInfo const &typeInfo = sectionTypeInfo[section->type];
|
||||
// Otherwise, how would the type already be known at this point?
|
||||
assume(section->isAddressFixed);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ std::vector<std::unique_ptr<Section>> sectionList;
|
||||
std::unordered_map<std::string, size_t> sectionMap; // Indexes into `sectionList`
|
||||
|
||||
void sect_ForEach(void (*callback)(Section &)) {
|
||||
for (auto &ptr : sectionList) {
|
||||
for (std::unique_ptr<Section> &ptr : sectionList) {
|
||||
callback(*ptr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user