summaryrefslogtreecommitdiff
path: root/binaryview.cpp
diff options
context:
space:
mode:
authorScott Lagler <laglerscott@gmail.com>2025-12-12 19:20:21 -0500
committerGlenn Smith <glenn@vector35.com>2025-12-16 17:45:24 -0500
commit6138978808829172448615980742756831959788 (patch)
tree746bb0a634c139967c1755dcbcfb8c3395b97ff5 /binaryview.cpp
parent3967000448807875468673398445854536525610 (diff)
Add more reserve calls
Diffstat (limited to 'binaryview.cpp')
-rw-r--r--binaryview.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/binaryview.cpp b/binaryview.cpp
index c1a22b0f..aaf63bf0 100644
--- a/binaryview.cpp
+++ b/binaryview.cpp
@@ -3095,6 +3095,7 @@ unordered_set<QualifiedName> BinaryView::GetOutgoingRecursiveTypeReferences(cons
{
size_t count;
vector<BNQualifiedName> apiTypes;
+ apiTypes.resize(types.size());
for (auto& type: types)
{
apiTypes.push_back(type.GetAPIObject());
@@ -3146,6 +3147,7 @@ unordered_set<QualifiedName> BinaryView::GetIncomingRecursiveTypeReferences(cons
{
size_t count;
vector<BNQualifiedName> apiTypes;
+ apiTypes.reserve(types.size());
for (auto& type: types)
{
apiTypes.push_back(type.GetAPIObject());
@@ -4045,6 +4047,7 @@ vector<DerivedString> BinaryView::GetDerivedStrings()
size_t count;
BNDerivedString* strings = BNGetDerivedStrings(m_object, &count);
vector<DerivedString> 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<string>
}
vector<const char*> coreOptions;
+ coreOptions.reserve(options.size());
for (auto& option : options)
coreOptions.push_back(option.c_str());
vector<const char*> 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<std::string>& archiveTypeIds, std::unordered_map<std::string, std::string>& updatedTypes)
{
std::vector<const char*> 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<std::string>& typeIds, std::unordered_map<std::string, std::string>& updatedTypes)
{
std::vector<const char*> apiTypeIds;
+ apiTypeIds.reserve(typeIds.size());
for (const auto& typeId: typeIds)
{
apiTypeIds.push_back(typeId.c_str());