This is insane behaviour. It's by design. We should change this, maybe so it looks more like this:
if (!menu_find_by_name( "Audio"))
menu_create("Audio", ICON_ML_AUDIO);
Note that it also works as a function to update the icon. Therefore it should really be called menu_find_or_create_by_name_and_update_icon(). Thus we should also split out menu_update_icon().
When that is done, we can remove static qualifier from menu_find_by_name(). Then we can find all uses of this kind of pattern: lens_info_menus[0].children[0].parent_menu->split_pos = -10; and make them more readable and much less fragile. I've broken code in the past by re-ordering menu items and not realising some other file had hard-coded the index of something it wanted to modify.
This is insane behaviour. It's by design. We should change this, maybe so it looks more like this:
Note that it also works as a function to update the icon. Therefore it should really be called
menu_find_or_create_by_name_and_update_icon(). Thus we should also split outmenu_update_icon().When that is done, we can remove
staticqualifier frommenu_find_by_name(). Then we can find all uses of this kind of pattern:lens_info_menus[0].children[0].parent_menu->split_pos = -10;and make them more readable and much less fragile. I've broken code in the past by re-ordering menu items and not realising some other file had hard-coded the index of something it wanted to modify.