fileutils: cleanup

Change-Id: I3229003d89a4c4855fb9429dd4fe9bff02ef7985
Reviewed-by: Sébastien Blin <sebastien.blin@savoirfairelinux.com>
This commit is contained in:
Adrien Béraud
2019-04-01 17:31:45 -04:00
committed by Sébastien Blin
parent c6bee418b6
commit 997147fc97
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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