menu: simplify usage for clients
commit0d35c3c8a0c2a1f1ff06eac20a12af0186753bc4
authorSascha Hauer <s.hauer@pengutronix.de>
Sat, 21 Aug 2010 18:09:51 +0000 (21 20:09 +0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Mon, 30 Aug 2010 19:06:02 +0000 (30 21:06 +0200)
treea3a82df9c3b83f36b2fecbd9faadb6b55fd19efd
parentc0477d8233369aed15a48239886ffa679802c48a
menu: simplify usage for clients

Clients now only have to call menu_add_submenu or menu_add_command_entry
instead of allocating many strings.
This also fixes some problems in the menu code. The priv field in struct
menu_entry was a pointer to struct menu or a pointer to an allocated string.
It was never freed, only had to be freed when it was an allocated string.
The reference to a submenu is now kept as a string and not to the menu
itself. The code checked the existence of the submenu when creating it, but
crashed when the submenu was removed and referenced afterwards. Now the
code hapily allows references to nonexistant menus but complains during
runtime when the menu is not there.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
commands/menu.c
common/menu.c
include/menu.h