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

Found with cppcheck.
This commit is contained in:
Ryan Pavlik 2011-11-02 13:33:39 -04:00 committed by Mathias Gumz
parent 5ae8bdf49d
commit d70bdbe675
2 changed files with 5 additions and 5 deletions

View file

@ -378,7 +378,7 @@ void Menu::enterSubmenu() {
if (submenu == 0) if (submenu == 0)
return; return;
if (submenu->menuitems.size() == 0) if (submenu->menuitems.empty())
return; return;
drawSubmenu(m_active_index); drawSubmenu(m_active_index);
@ -773,7 +773,7 @@ void Menu::drawSubmenu(unsigned int index) {
int Menu::drawItem(FbDrawable &drawable, unsigned int index, int Menu::drawItem(FbDrawable &drawable, unsigned int index,
bool highlight, bool exclusive_drawable) { bool highlight, bool exclusive_drawable) {
if (index >= menuitems.size() || menuitems.size() == 0 || if (index >= menuitems.size() || menuitems.empty() ||
m_rows_per_column == 0) m_rows_per_column == 0)
return 0; return 0;

View file

@ -346,7 +346,7 @@ void FbRun::lockPosition(bool size_too) {
} }
void FbRun::prevHistoryItem() { 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); XBell(m_display, 0);
} else { } else {
m_current_history_item--; m_current_history_item--;
@ -370,7 +370,7 @@ void FbRun::nextHistoryItem() {
} }
void FbRun::firstHistoryItem() { 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); XBell(m_display, 0);
} else { } else {
m_current_history_item = 0; m_current_history_item = 0;
@ -380,7 +380,7 @@ void FbRun::firstHistoryItem() {
void FbRun::lastHistoryItem() { void FbRun::lastHistoryItem() {
// actually one past the end // actually one past the end
if (m_history.size() == 0) { if (m_history.empty()) {
XBell(m_display, 0); XBell(m_display, 0);
} else { } else {
m_current_history_item = m_history.size(); m_current_history_item = m_history.size();