From b3e512b296827c3e7a688ca99a13dd68c6c758d4 Mon Sep 17 00:00:00 2001 From: pit-ray Date: Sun, 14 Jan 2024 21:30:12 +0900 Subject: [PATCH] fix coveity defects --- src/bind/bindinglist.cpp | 5 +++++ src/bind/bindinglist.hpp | 3 ++- src/opt/optionlist.hpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bind/bindinglist.cpp b/src/bind/bindinglist.cpp index 4284a24c..25645220 100644 --- a/src/bind/bindinglist.cpp +++ b/src/bind/bindinglist.cpp @@ -319,5 +319,10 @@ namespace vind BindedFunc::SPtr search_func(const std::string& name) { return search_func(BindedFunc::name_to_id(util::A2a(name))) ; } + + BindedFunc::SPtr search_func(std::string&& name) { + return search_func( + BindedFunc::name_to_id(util::A2a(std::move(name)))) ; + } } } diff --git a/src/bind/bindinglist.hpp b/src/bind/bindinglist.hpp index e89ac59a..b5a330c4 100644 --- a/src/bind/bindinglist.hpp +++ b/src/bind/bindinglist.hpp @@ -13,10 +13,11 @@ namespace vind BindedFunc::SPtr search_func(std::size_t id) ; BindedFunc::SPtr search_func(const std::string& name) ; + BindedFunc::SPtr search_func(std::string&& name) ; template inline bool check_if_func(T&& arg) { - return search_func(arg) != nullptr ; + return search_func(std::forward(arg)) != nullptr ; } } } diff --git a/src/opt/optionlist.hpp b/src/opt/optionlist.hpp index 151654e8..8459f8bf 100644 --- a/src/opt/optionlist.hpp +++ b/src/opt/optionlist.hpp @@ -37,7 +37,7 @@ namespace vind template inline bool check_if_option(T&& name) { - return search_option(name) != nullptr ; + return search_option(std::forward(name)).get() != nullptr ; } } }