Fix MENU TITLE -> MENU LABEL inheritance syslinux-3.62-pre12
authorH. Peter Anvin <hpa@zytor.com>
Wed, 20 Feb 2008 02:40:37 +0000 (18:40 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 20 Feb 2008 02:40:37 +0000 (18:40 -0800)
Correctly make it so MENU TITLE can be inherited upward as MENU TITLE
unless one is provided.

com32/menu/readconfig.c

index 7efee91..a17beb2 100644 (file)
@@ -119,7 +119,7 @@ static struct menu * new_menu(struct menu *parent,
   struct menu *m = calloc(1, sizeof(struct menu));
   int i;
 
-  m->label = refstrdup(label);
+  m->label = label;
   m->title = refstr_get(empty_string);
 
   if (parent) {
@@ -347,7 +347,7 @@ static struct menu *begin_submenu(const char *tag)
 
   me = new_entry(current_menu);
   me->displayname = refstrdup(tag);
-  return new_menu(current_menu, me, tag);
+  return new_menu(current_menu, me, refstr_get(me->displayname));
 }
 
 static struct menu *end_submenu(void)
@@ -583,7 +583,7 @@ static void parse_config_file(FILE *f)
        m->title = refstrdup(skipspace(p+5));
        if (m->parent_entry) {
          /* MENU TITLE -> MENU LABEL on submenu */
-         if (m->parent_entry->displayname == m->parent_entry->label) {
+         if (m->parent_entry->displayname == m->label) {
            refstr_put(m->parent_entry->displayname);
            m->parent_entry->displayname = refstr_get(m->title);
          }
@@ -905,8 +905,8 @@ void parse_configs(char **argv)
   empty_string = refstrdup("");
 
   /* Initialize defaults for the root and hidden menus */
-  hide_menu = new_menu(NULL, NULL, ".hidden");
-  root_menu = new_menu(NULL, NULL, ".top");
+  hide_menu = new_menu(NULL, NULL, refstrdup(".hidden"));
+  root_menu = new_menu(NULL, NULL, refstrdup(".top"));
   start_menu = root_menu;
 
   /* Other initialization */