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 /database.cpp | |
| parent | 3967000448807875468673398445854536525610 (diff) | |
Add more reserve calls
Diffstat (limited to 'database.cpp')
| -rw-r--r-- | database.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/database.cpp b/database.cpp index 0fdc50e1..e1cdebd6 100644 --- a/database.cpp +++ b/database.cpp @@ -248,6 +248,7 @@ vector<Ref<Snapshot>> Snapshot::GetParents() size_t count; BNSnapshot** parents = BNGetSnapshotParents(m_object, &count); vector<Ref<Snapshot>> result; + result.reserve(count); for (size_t i = 0; i < count; i++) { result.push_back(new Snapshot(BNNewSnapshotReference(parents[i]))); @@ -262,6 +263,7 @@ vector<Ref<Snapshot>> Snapshot::GetChildren() size_t count; BNSnapshot** children = BNGetSnapshotChildren(m_object, &count); vector<Ref<Snapshot>> result; + result.reserve(count); for (size_t i = 0; i < count; i++) { result.push_back(new Snapshot(BNNewSnapshotReference(children[i]))); @@ -323,6 +325,7 @@ vector<Ref<UndoEntry>> Snapshot::GetUndoEntries(const ProgressFunction& progress } vector<Ref<UndoEntry>> result; + result.reserve(count); for (size_t i = 0; i < count; i++) { result.push_back(new UndoEntry(BNNewUndoEntryReference(entries[i]))); @@ -390,6 +393,7 @@ vector<Ref<Snapshot>> Database::GetSnapshots() size_t count; BNSnapshot** snapshots = BNGetDatabaseSnapshots(m_object, &count); vector<Ref<Snapshot>> result; + result.reserve(count); for (size_t i = 0; i < count; i++) result.push_back(new Snapshot(BNNewSnapshotReference(snapshots[i]))); BNFreeSnapshotList(snapshots, count); @@ -455,6 +459,7 @@ std::vector<std::string> Database::GetGlobalKeys() const } std::vector<std::string> result; + result.reserve(count); for (size_t i = 0; i < count; i++) { result.push_back(value[i]); |
