]> xenbits.xensource.com Git - osstest.git/commitdiff
Debian grub2: Optimize and re-format submenu parsing
authorRobert Ho <robert.hu@intel.com>
Mon, 17 Aug 2015 03:34:04 +0000 (11:34 +0800)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 25 Sep 2015 10:56:54 +0000 (11:56 +0100)
* space between ')' and '{'; and after '='
* omit unnecessary 'define' and '!defined' usage
* break long '{}' into several lines

Signed-off-by: Robert Ho <robert.hu@intel.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v14: Drop removal of MenuEntryPath setting in grub2 submenu parse

Osstest/Debian.pm

index a8b62cad4e5111246faf9d7225ab284dc989339d..2b8d9f3e67eca9d2fc430e4cf8d940280ca9b61a 100644 (file)
@@ -421,10 +421,10 @@ sub setupboot_grub2 ($$$$) {
             next if m/^\s*\#/ || !m/\S/;
             if (m/^\s*\}\s*$/) {
                 die unless $entry || $submenu;
-                if (!defined $entry && defined $submenu) {
+                if (!$entry && $submenu) {
                     logm("Met end of a submenu $submenu->{StartLine}..$.. ".
                         "Our want kern is $want_kernver");
-                    $submenu=undef;
+                    $submenu= undef;
                     pop @offsets;
                     $offsets[$#offsets]++;
                     next;
@@ -465,7 +465,9 @@ sub setupboot_grub2 ($$$$) {
             }
             if (m/^\s*menuentry\s+[\'\"](.*)[\'\"].*\{\s*$/) {
                 die $entry->{StartLine} if $entry;
-                $entry= { Title => $1, StartLine => $., MenuEntryPath => join ">", @offsets };
+                $entry= { Title => $1,
+                         StartLine => $.,
+                         MenuEntryPath => join ">", @offsets };
                 $offsets[$#offsets]++;
             }
             if (m/^\s*submenu\s+[\'\"](.*)[\'\"].*\{\s*$/) {