all repos — fluxbox @ d70bdbe6759ff47b76802aaa02ff8a0cdac20512

custom fork of the fluxbox windowmanager

Check .empty() instead of .size() == 0

Found with cppcheck.
Ryan Pavlik rpavlik@iastate.edu
commit

d70bdbe6759ff47b76802aaa02ff8a0cdac20512

parent

5ae8bdf49db36b2691ce545e3285f9ee64f92148

2 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/FbTk/Menu.ccsrc/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.ccutil/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();