[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTest Nested v12 01/21] Optimize and re-format previous code of 'submenu' parsing



* space between ')' and '{'; and after '='
* omit unnecessary 'define' and '!defined' usage
* break long '{}' into several lines

Signed-off-by: Robert Ho <robert.hu@xxxxxxxxx>
---
 Osstest/Debian.pm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index f0bcf06..c6b4720 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -417,10 +417,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;
@@ -461,11 +461,13 @@ 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*$/) {
-                $submenu={ StartLine =>$., MenuEntryPath => join ">", @offsets 
};
+                $submenu= { StartLine =>$. };
                 push @offsets,(0);
             }
             if (m/^\s*chainloader\s*\/EFI\/osstest\/xen.efi/) {
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.