Skip to content

Commit

Permalink
fix coveity defects
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Jan 14, 2024
1 parent 2ee00d3 commit b3e512b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/bind/bindinglist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))) ;
}
}
}
3 changes: 2 additions & 1 deletion src/bind/bindinglist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
inline bool check_if_func(T&& arg) {
return search_func(arg) != nullptr ;
return search_func(std::forward<T>(arg)) != nullptr ;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/opt/optionlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace vind

template <typename T>
inline bool check_if_option(T&& name) {
return search_option(name) != nullptr ;
return search_option(std::forward<T>(name)).get() != nullptr ;
}
}
}
Expand Down

0 comments on commit b3e512b

Please sign in to comment.