From ae417fc14cae2fc99122cd35e48bd86bf67e274c Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 20 Aug 2019 14:44:16 -0500 Subject: [PATCH] Use emplace_back. NFC. Found by clang-tidy. --- src/platform/platform.cpp | 6 +++--- src/platform/utilunix.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platform/platform.cpp b/src/platform/platform.cpp index 33b6579..e2382d4 100644 --- a/src/platform/platform.cpp +++ b/src/platform/platform.cpp @@ -295,7 +295,7 @@ Path Path::Expand(bool fromCurrentDirectory) const { if(expanded.IsEmpty()) { if(expandedComponents.empty()) { - expandedComponents.push_back("."); + expandedComponents.emplace_back("."); } expanded = From(Concat(expandedComponents, SEPARATOR)); } else if(!expandedComponents.empty()) { @@ -371,12 +371,12 @@ Path Path::RelativeTo(const Path &base) const { std::vector resultComponents; for(size_t i = common; i < baseComponents.size(); i++) { - resultComponents.push_back(".."); + resultComponents.emplace_back(".."); } resultComponents.insert(resultComponents.end(), components.begin() + common, components.end()); if(resultComponents.empty()) { - resultComponents.push_back("."); + resultComponents.emplace_back("."); } return From(Concat(resultComponents, SEPARATOR)); } diff --git a/src/platform/utilunix.cpp b/src/platform/utilunix.cpp index 0275bd6..bf7d7e3 100644 --- a/src/platform/utilunix.cpp +++ b/src/platform/utilunix.cpp @@ -77,8 +77,9 @@ void MemFree(void *p) { std::vector InitPlatform(int argc, char **argv) { std::vector args; + args.reserve(argc); for(int i = 0; i < argc; i++) { - args.push_back(argv[i]); + args.emplace_back(argv[i]); } return args; }