From 16a6453842befb2d038ee6c130252c8e2da12086 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 3 Aug 2009 01:42:08 +0000 Subject: Don't recalculate the array length during the loop, use the ARRAYLEN macro and correct the type of the variable i. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22130 a1c6a512-1295-4272-9138-f99709370657 --- apps/root_menu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/root_menu.c b/apps/root_menu.c index 37fda98cb3..1c86b6fe23 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -436,8 +436,9 @@ static int item_callback(int action, const struct menu_item_ex *this_item) } static int get_selection(int last_screen) { - unsigned int i; - for(i=0; i< sizeof(root_menu__)/sizeof(*root_menu__); i++) + int i; + int len = ARRAYLEN(root_menu__); + for(i=0; i < len; i++) { if (((root_menu__[i]->flags&MENU_TYPE_MASK) == MT_RETURN_VALUE) && (root_menu__[i]->value == last_screen)) -- cgit v1.2.3