mconf/nconf: mark empty menus/menuconfigs different from non-empty ones
[carl9170fw.git] / config / menu.c
index fd3f0180e08fbafb537e128c9e46641288c68774..7e233a6ca64ef7faf1bc9390ec89cb90ccef2d98 100644 (file)
@@ -443,6 +443,22 @@ bool menu_has_prompt(struct menu *menu)
        return true;
 }
 
+/*
+ * Determine if a menu is empty.
+ * A menu is considered empty if it contains no or only
+ * invisible entries.
+ */
+bool menu_is_empty(struct menu *menu)
+{
+       struct menu *child;
+
+       for (child = menu->list; child; child = child->next) {
+               if (menu_is_visible(child))
+                       return(false);
+       }
+       return(true);
+}
+
 bool menu_is_visible(struct menu *menu)
 {
        struct menu *child;