diff options
| author | Scott Lagler <laglerscott@gmail.com> | 2025-12-12 19:20:21 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-12-16 17:45:24 -0500 |
| commit | 6138978808829172448615980742756831959788 (patch) | |
| tree | 746bb0a634c139967c1755dcbcfb8c3395b97ff5 /platform.cpp | |
| parent | 3967000448807875468673398445854536525610 (diff) | |
Add more reserve calls
Diffstat (limited to 'platform.cpp')
| -rw-r--r-- | platform.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/platform.cpp b/platform.cpp index 1ceaf4c0..323e7d76 100644 --- a/platform.cpp +++ b/platform.cpp @@ -124,11 +124,14 @@ void Platform::AdjustTypeParserInputCallback( Ref<TypeParser> parserCpp = new CoreTypeParser(parser); vector<string> arguments; + arguments.reserve(argumentsLenIn); for (size_t i = 0; i < argumentsLenIn; i ++) { arguments.push_back(argumentsIn[i]); } + vector<pair<string, string>> sourceFiles; + sourceFiles.reserve(sourceFilesLenIn); for (size_t i = 0; i < sourceFilesLenIn; i ++) { sourceFiles.push_back(make_pair(sourceFileNamesIn[i], sourceFileValuesIn[i])); @@ -141,6 +144,7 @@ void Platform::AdjustTypeParserInputCallback( ); vector<const char*> argumentsPtrs; + argumentsPtrs.reserve(arguments.size()); for (auto& argument : arguments) { argumentsPtrs.push_back(argument.c_str()); @@ -490,6 +494,7 @@ void CorePlatform::AdjustTypeParserInput( ) { vector<const char*> argumentsIn; + argumentsIn.reserve(arguments.size()); for (size_t i = 0; i < arguments.size(); i ++) { argumentsIn.push_back(arguments[i].c_str()); @@ -561,6 +566,7 @@ std::vector<Ref<Platform>> Platform::GetRelatedPlatforms() BNPlatform** related = BNGetRelatedPlatforms(m_object, &count); std::vector<Ref<Platform>> result; + result.reserve(count); for (size_t i = 0; i < count; i++) { result.push_back(new CorePlatform(BNNewPlatformReference(related[i]))); @@ -656,6 +662,7 @@ vector<Ref<TypeLibrary>> Platform::GetTypeLibraries() BNTypeLibrary** libs = BNGetPlatformTypeLibraries(m_object, &count); vector<Ref<TypeLibrary>> result; + result.reserve(count); for (size_t i = 0; i < count; ++i) { result.push_back(new TypeLibrary(BNNewTypeLibraryReference(libs[i]))); @@ -672,6 +679,7 @@ vector<Ref<TypeLibrary>> Platform::GetTypeLibrariesByName(const std::string& nam BNTypeLibrary** libs = BNGetPlatformTypeLibrariesByName(m_object, name.c_str(), &count); vector<Ref<TypeLibrary>> result; + result.reserve(count); for (size_t i = 0; i < count; ++i) { result.push_back(new TypeLibrary(BNNewTypeLibraryReference(libs[i]))); |
