Skip to content

Commit

Permalink
enum_dir: restore move semantics
Browse files Browse the repository at this point in the history
This commit mostly reverts a previous commit:

commit b7bc687

    Avoid compiler warning with gcc by not using move semantics

The previous commit changed the semantics of the client
callback to use copy instead of move semantics on the
filename string to placate a compiler warning which was
later determined to be a false positive.

We revert to calling the client-provided func()
with move semantics on the filename parameter.

We also retain the use of std::invoke to call the
client-provided callback.

Signed-off-by: James Yonan <james@openvpn.net>
  • Loading branch information
jamesyonan authored and dsommers committed Aug 9, 2023
1 parent aec6902 commit 5c27ed2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openvpn/common/enumdir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <utility>
#include <memory>
#include <algorithm>
#include <functional>

#include <openvpn/common/size.hpp>
#include <openvpn/common/exception.hpp>
Expand All @@ -52,7 +53,7 @@ inline bool enum_dir(const std::string &dirname,
{
std::string fn(e->d_name);
if (fn != "." && fn != "..")
std::invoke(func, fn);
std::invoke(func, std::move(fn));
}
return true;
}
Expand Down

0 comments on commit 5c27ed2

Please sign in to comment.