From fb601354e11d8c0db41cd119d51fe1acd4afa648 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 18 Dec 2018 16:38:13 +0000 Subject: [PATCH] Fix previous commit to move instead of copying * src/filesystem/std-dir.cc (filesystem::_Dir::advance): Move new path instead of copying. From-SVN: r267237 --- libstdc++-v3/ChangeLog | 3 +++ libstdc++-v3/src/filesystem/std-dir.cc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index eefc953f5ca..5378bc38632 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2018-12-18 Jonathan Wakely + * src/filesystem/std-dir.cc (filesystem::_Dir::advance): Move new + path instead of copying. + * src/filesystem/std-dir.cc (filesystem::_Dir::advance): Append string to lvalue to avoid creating temporary path. diff --git a/libstdc++-v3/src/filesystem/std-dir.cc b/libstdc++-v3/src/filesystem/std-dir.cc index 216182a2e56..b0f869fc8fd 100644 --- a/libstdc++-v3/src/filesystem/std-dir.cc +++ b/libstdc++-v3/src/filesystem/std-dir.cc @@ -63,7 +63,7 @@ struct fs::_Dir : _Dir_base { auto name = path; name /= entp->d_name; - entry = fs::directory_entry{name, get_file_type(*entp)}; + entry = fs::directory_entry{std::move(name), get_file_type(*entp)}; return true; } else if (!ec) -- 2.30.2