/* Returns the number of menuitems in the menu. 
Counts all menuitems including MENUITEM_GROUP menuitems which are not selectable. The count does not include the terminating MENUITEM_NULL element. */
static int menu_get_size(const menu_t *menu)
/* Returns the number of menuitems in the menu. 
Counts all menuitems including MENUITEM_GROUP menuitems which are not selectable. The count does not include the terminating MENUITEM_NULL element. */
static int menu_get_size(const menu_t *menu)
{
    int menuitem_count = 0;
    const menuitem_t* menuitem = menu->menuitems;
    while (menuitem->type != MenuItem_Null)
    {
        ++menuitem_count;
        ++menuitem;
    }
    return menuitem_count;
}