Skip to content

Commit

Permalink
fix coverity defects
Browse files Browse the repository at this point in the history
  • Loading branch information
pit-ray committed Jan 14, 2024
1 parent b3e512b commit 3aec015
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/bind/bindinglist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace vind

template <typename T>
inline bool check_if_func(T&& arg) {
return search_func(std::forward<T>(arg)) != nullptr ;
return search_func(std::forward<T>(arg)).get() != nullptr ;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bind/syscmd/autocmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace vind

auto [event_str, patcmd] = core::extract_double_args(pargs) ;
auto [pattern, cmd] = core::extract_double_args(patcmd) ;
auto patterns = util::split(std::move(pattern), ",") ;
auto patterns = util::split(pattern, ",") ;

if(event_str == "*") {
if(patterns.empty()) {
Expand Down
6 changes: 2 additions & 4 deletions src/bind/window/arrange_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@ namespace vind
}
void ArrangeWindows::reconstruct() {
g_ignores.clear() ;

auto& settable = core::SetTable::get_instance() ;
auto str = settable.get("arrangewin_ignore").get<std::string>() ;

auto modules = util::split(std::move(str), ",") ;
auto modules = util::split(
settable.get("arrangewin_ignore").get<std::string>(), ",") ;
for(auto& m : modules) {
g_ignores.insert(util::A2a(util::trim(m))) ;
}
Expand Down
12 changes: 8 additions & 4 deletions src/core/autocmd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ namespace vind
{Mode::RESIDENT, AutoCmdEvent::RESIDENT_ENTER},
{Mode::COMMAND, AutoCmdEvent::COMMAND_ENTER}
} ;
if(enter_events.find(mode) != enter_events.end()) {
try {
return enter_events.at(mode) ;
}
return AutoCmdEvent::UNDEFINED ;
catch(const std::out_of_range&) {
return AutoCmdEvent::UNDEFINED ;
}
}

inline AutoCmdEvent get_leave_event(Mode mode) {
Expand All @@ -64,10 +66,12 @@ namespace vind
{Mode::RESIDENT, AutoCmdEvent::RESIDENT_LEAVE},
{Mode::COMMAND, AutoCmdEvent::COMMAND_LEAVE}
} ;
if(leave_events.find(mode) != leave_events.end()) {
try {
return leave_events.at(mode) ;
}
return AutoCmdEvent::UNDEFINED ;
catch(const std::out_of_range&) {
return AutoCmdEvent::UNDEFINED ;
}
}


Expand Down

0 comments on commit 3aec015

Please sign in to comment.