Skip to content
Snippets Groups Projects
Commit 997147fc authored by Adrien Béraud's avatar Adrien Béraud Committed by Sébastien Blin
Browse files

fileutils: cleanup


Change-Id: I3229003d89a4c4855fb9429dd4fe9bff02ef7985
Reviewed-by: default avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent c6bee418
No related branches found
No related tags found
No related merge requests found
...@@ -115,11 +115,11 @@ CallFactory::getAllCalls<Call>() const ...@@ -115,11 +115,11 @@ CallFactory::getAllCalls<Call>() const
for (const auto& itemmap : callMaps_) { for (const auto& itemmap : callMaps_) {
const auto& map = itemmap.second; 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.push_back(item.second);
} }
v.shrink_to_fit();
return v; return v;
} }
......
...@@ -412,10 +412,10 @@ readDirectory(const std::string& dir) ...@@ -412,10 +412,10 @@ readDirectory(const std::string& dir)
#else #else
while ((entry = readdir(dp)) != nullptr) { while ((entry = readdir(dp)) != nullptr) {
#endif #endif
const std::string fname {entry->d_name}; std::string fname {entry->d_name};
if (fname == "." || fname == "..") if (fname == "." || fname == "..")
continue; continue;
files.push_back(std::move(fname)); files.emplace_back(std::move(fname));
} }
closedir(dp); closedir(dp);
return files; return files;
...@@ -691,7 +691,7 @@ recursive_mkdir(const std::string& path, mode_t mode) ...@@ -691,7 +691,7 @@ recursive_mkdir(const std::string& path, mode_t mode)
if (mkdir(path.data()) != 0) { if (mkdir(path.data()) != 0) {
#endif #endif
if (errno == ENOENT) { 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 #ifndef _WIN32
if (mkdir(path.data(), mode) != 0) { if (mkdir(path.data(), mode) != 0) {
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment