From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Ho Subject: [OSSTest Nested v12 01/21] Optimize and re-format previous code of 'submenu' parsing Date: Fri, 28 Aug 2015 23:07:50 +0800 Message-ID: <1440774490-16725-2-git-send-email-robert.hu@intel.com> References: <1440774490-16725-1-git-send-email-robert.hu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1440774490-16725-1-git-send-email-robert.hu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org, robert.hu@intel.com Cc: wei.liu2@citrix.com, Ian.Jackson@eu.citrix.com, ian.campbell@citrix.com, di.zheng@intel.com, gordon.jin@intel.com List-Id: xen-devel@lists.xenproject.org * space between ')' and '{'; and after '=' * omit unnecessary 'define' and '!defined' usage * break long '{}' into several lines Signed-off-by: Robert Ho --- 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