diff --git a/src/call_factory.cpp b/src/call_factory.cpp index 2f75ebe621a31eeb946840acf1f549a25559ccab..3ad0f4f724f5907be7ea0e335180b52474024618 100644 --- a/src/call_factory.cpp +++ b/src/call_factory.cpp @@ -115,11 +115,11 @@ CallFactory::getAllCalls<Call>() const for (const auto& itemmap : callMaps_) { const auto& map = itemmap.second; - for (const auto item : map) + v.reserve(v.size() + map.size()); + for (const auto& item : map) v.push_back(item.second); } - v.shrink_to_fit(); return v; } diff --git a/src/fileutils.cpp b/src/fileutils.cpp index 70915a4c2277806d0d5dfb56c1432110c5b56b5c..ffd2eceefc9621c2927febb4344bc0f0d2792253 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -412,10 +412,10 @@ readDirectory(const std::string& dir) #else while ((entry = readdir(dp)) != nullptr) { #endif - const std::string fname {entry->d_name}; + std::string fname {entry->d_name}; if (fname == "." || fname == "..") continue; - files.push_back(std::move(fname)); + files.emplace_back(std::move(fname)); } closedir(dp); return files; @@ -691,7 +691,7 @@ recursive_mkdir(const std::string& path, mode_t mode) if (mkdir(path.data()) != 0) { #endif if (errno == ENOENT) { - recursive_mkdir(path.substr(0, path.find_last_of(DIR_SEPARATOR_STR)), mode); + recursive_mkdir(path.substr(0, path.find_last_of(DIR_SEPARATOR_CH)), mode); #ifndef _WIN32 if (mkdir(path.data(), mode) != 0) { #else