From 5c27ed24b1c85794b418652f2d5f8a70de8ecbc6 Mon Sep 17 00:00:00 2001 From: James Yonan Date: Fri, 4 Aug 2023 10:54:03 -0600 Subject: [PATCH] enum_dir: restore move semantics This commit mostly reverts a previous commit: commit b7bc68739669ceb9f3f8e93903240976c6d79864 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 --- openvpn/common/enumdir.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openvpn/common/enumdir.hpp b/openvpn/common/enumdir.hpp index 120ee4a43..f644778c9 100644 --- a/openvpn/common/enumdir.hpp +++ b/openvpn/common/enumdir.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -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; }