Check .empty() instead of .size() == 0 Found with cppcheck.
Ryan Pavlik rpavlik@iastate.edu
2 files changed,
5 insertions(+),
5 deletions(-)
M
src/FbTk/Menu.cc
→
src/FbTk/Menu.cc
@@ -378,7 +378,7 @@ Menu *submenu = menuitems[m_active_index]->submenu();
if (submenu == 0) return; - if (submenu->menuitems.size() == 0) + if (submenu->menuitems.empty()) return; drawSubmenu(m_active_index);@@ -773,7 +773,7 @@
int Menu::drawItem(FbDrawable &drawable, unsigned int index, bool highlight, bool exclusive_drawable) { - if (index >= menuitems.size() || menuitems.size() == 0 || + if (index >= menuitems.size() || menuitems.empty() || m_rows_per_column == 0) return 0;
M
util/fbrun/FbRun.cc
→
util/fbrun/FbRun.cc
@@ -346,7 +346,7 @@ XSetWMNormalHints(m_display, window(), &sh);
} void FbRun::prevHistoryItem() { - if (m_history.size() == 0 || m_current_history_item == 0) { + if (m_history.empty() || m_current_history_item == 0) { XBell(m_display, 0); } else { m_current_history_item--;@@ -370,7 +370,7 @@ }
} void FbRun::firstHistoryItem() { - if (m_history.size() == 0 || m_current_history_item == 0) { + if (m_history.empty() || m_current_history_item == 0) { XBell(m_display, 0); } else { m_current_history_item = 0;@@ -380,7 +380,7 @@ }
void FbRun::lastHistoryItem() { // actually one past the end - if (m_history.size() == 0) { + if (m_history.empty()) { XBell(m_display, 0); } else { m_current_history_item = m_history.size();