mirror of
https://github.com/zeldaret/botw
synced 2026-05-23 06:54:18 -04:00
Use sead::Buffer::fill where applicable
Equivalent, shorter, more readable, and matching!
This commit is contained in:
@@ -18,7 +18,6 @@ AS::~AS() = default;
|
||||
|
||||
void AS::doCreate_(u8*, u32, sead::Heap*) {}
|
||||
|
||||
// NON_MATCHING: SafeString vtable load is reordered
|
||||
bool AS::parse_(u8* data, size_t size, sead::Heap* parent_heap) {
|
||||
mHeap = util::tryCreateDualHeap(parent_heap);
|
||||
if (!mHeap)
|
||||
@@ -47,8 +46,7 @@ bool AS::parse_(u8* data, size_t size, sead::Heap* parent_heap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0, n = mElementResources.size(); i < n; ++i)
|
||||
mElementResources(i) = nullptr;
|
||||
mElementResources.fill(nullptr);
|
||||
|
||||
ASResource::ParseArgs args;
|
||||
args.list = {};
|
||||
|
||||
@@ -228,8 +228,7 @@ bool ASResourceWithChildren::doParse(const ASResource::ParseArgs& args) {
|
||||
|
||||
if (!mChildren.tryAllocBuffer(size, args.heap))
|
||||
return false;
|
||||
for (int i = 0, n = mChildren.size(); i < n; ++i)
|
||||
mChildren(i) = nullptr;
|
||||
mChildren.fill(nullptr);
|
||||
|
||||
for (auto it = mChildren.begin(), end = mChildren.end(); it != end; ++it) {
|
||||
const auto idx = *Children.getParameterData<int>(it.getIndex());
|
||||
|
||||
@@ -259,8 +259,7 @@ bool ASExtensions::parse(const ASExtensions::ParseArgs& args) {
|
||||
|
||||
if (!mParsers.tryAllocBuffer(num_extensions, args.heap))
|
||||
return false;
|
||||
for (int i = 0, n = mParsers.size(); i < n; ++i)
|
||||
mParsers(i) = nullptr;
|
||||
mParsers.fill(nullptr);
|
||||
|
||||
auto it = mParsers.begin();
|
||||
const auto end = mParsers.end();
|
||||
|
||||
@@ -22,9 +22,7 @@ public:
|
||||
void alloc(int capacity, sead::Heap* heap) {
|
||||
SEAD_ASSERT(sead::Mathi::isPow2(capacity));
|
||||
mBuffer.allocBufferAssert(capacity, heap);
|
||||
|
||||
for (int i = 0, n = getCapacity(); i < n; ++i)
|
||||
mBuffer(i) = nullptr;
|
||||
mBuffer.fill(nullptr);
|
||||
}
|
||||
|
||||
void freeBuffer() { mBuffer.freeBuffer(); }
|
||||
|
||||
Reference in New Issue
Block a user