summaryrefslogtreecommitdiffstats
path: root/common/menu.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-08-21 17:03:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-08-30 20:57:20 +0200
commita75d6dacc3832c9c07eef3bfb35d591eec5b6a58 (patch)
treeedca22cfcd8367d588c2cd116255c087a513b0f2 /common/menu.c
parentf371f04df2d333fe3c3bd8968623fabde9d1f088 (diff)
downloadbarebox-a75d6dacc3832c9c07eef3bfb35d591eec5b6a58.tar.gz
barebox-a75d6dacc3832c9c07eef3bfb35d591eec5b6a58.tar.xz
menu: simplify menu_free with list_for_each_entry_safe
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/menu.c')
-rw-r--r--common/menu.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/common/menu.c b/common/menu.c
index 9c40365e1a..6fd74a05ad 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -39,21 +39,15 @@ struct menu* menu_get_menus(void)
void menu_free(struct menu *m)
{
- struct list_head *pos;
- struct menu_entry *me;
+ struct menu_entry *me, *tmp;
if (!m)
return;
free(m->name);
free(m->display);
- pos = &m->entries.list;
-
- if (pos->prev != pos->next && pos->prev != 0)
- list_for_each(pos, &m->entries.list) {
- me = list_entry(pos, struct menu_entry, list);
- menu_entry_free(me);
- }
+ list_for_each_entry_safe(me, tmp, &m->entries.list, list)
+ menu_entry_free(me);
free(m);
}