summaryrefslogtreecommitdiff
path: root/typeprinter.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 /typeprinter.cpp
parent3967000448807875468673398445854536525610 (diff)
Add more reserve calls
Diffstat (limited to 'typeprinter.cpp')
-rw-r--r--typeprinter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/typeprinter.cpp b/typeprinter.cpp
index 3b36da9d..9a67785a 100644
--- a/typeprinter.cpp
+++ b/typeprinter.cpp
@@ -121,6 +121,7 @@ bool TypePrinter::PrintAllTypesCallback(void* ctxt, BNQualifiedName* names, BNTy
{
TypePrinter* printer = (TypePrinter*)ctxt;
vector<pair<QualifiedName, Ref<Type>>> apiTypes;
+ apiTypes.reserve(typeCount);
for (size_t i = 0; i < typeCount; ++i)
{
apiTypes.push_back({QualifiedName::FromAPIObject(&names[i]), new Type(types[i])});
@@ -173,6 +174,7 @@ std::vector<Ref<TypePrinter>> TypePrinter::GetList()
size_t count;
BNTypePrinter** list = BNGetTypePrinterList(&count);
vector<Ref<TypePrinter>> result;
+ result.reserve(count);
for (size_t i = 0; i < count; i++)
result.push_back(new CoreTypePrinter(list[i]));
BNFreeTypePrinterList(list);
@@ -449,7 +451,7 @@ std::vector<TypeDefinitionLine> CoreTypePrinter::GetTypeLines(Ref<Type> type,
return {};
vector<TypeDefinitionLine> cppLines;
-
+ cppLines.reserve(lineCount);
for (size_t i = 0; i < lineCount; ++i)
{
cppLines.push_back(TypeDefinitionLine::FromAPIObject(&lines[i]));