From 6138978808829172448615980742756831959788 Mon Sep 17 00:00:00 2001 From: Scott Lagler Date: Fri, 12 Dec 2025 19:20:21 -0500 Subject: Add more reserve calls --- binaryview.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index c1a22b0f..aaf63bf0 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3095,6 +3095,7 @@ unordered_set BinaryView::GetOutgoingRecursiveTypeReferences(cons { size_t count; vector apiTypes; + apiTypes.resize(types.size()); for (auto& type: types) { apiTypes.push_back(type.GetAPIObject()); @@ -3146,6 +3147,7 @@ unordered_set BinaryView::GetIncomingRecursiveTypeReferences(cons { size_t count; vector apiTypes; + apiTypes.reserve(types.size()); for (auto& type: types) { apiTypes.push_back(type.GetAPIObject()); @@ -4045,6 +4047,7 @@ vector BinaryView::GetDerivedStrings() size_t count; BNDerivedString* strings = BNGetDerivedStrings(m_object, &count); vector result; + result.reserve(count); for (size_t i = 0; i < count; i++) result.push_back(DerivedString::FromAPIObject(&strings[i], false)); BNFreeDerivedStringList(strings, count); @@ -4281,10 +4284,12 @@ bool BinaryView::ParseTypesFromSource(const string& source, const vector } vector coreOptions; + coreOptions.reserve(options.size()); for (auto& option : options) coreOptions.push_back(option.c_str()); vector coreIncludeDirs; + coreIncludeDirs.reserve(includeDirs.size()); for (auto& includeDir : includeDirs) coreIncludeDirs.push_back(includeDir.c_str()); @@ -4911,6 +4916,7 @@ bool BinaryView::DisassociateTypeArchiveType(const std::string& typeId) bool BinaryView::PullTypeArchiveTypes(const std::string& archiveId, const std::unordered_set& archiveTypeIds, std::unordered_map& updatedTypes) { std::vector apiArchiveTypeIds; + apiArchiveTypeIds.reserve(archiveTypeIds.size()); for (const auto& archiveTypeId: archiveTypeIds) { apiArchiveTypeIds.push_back(archiveTypeId.c_str()); @@ -4935,6 +4941,7 @@ bool BinaryView::PullTypeArchiveTypes(const std::string& archiveId, const std::u bool BinaryView::PushTypeArchiveTypes(const std::string& archiveId, const std::unordered_set& typeIds, std::unordered_map& updatedTypes) { std::vector apiTypeIds; + apiTypeIds.reserve(typeIds.size()); for (const auto& typeId: typeIds) { apiTypeIds.push_back(typeId.c_str()); -- cgit v1.3.1