From 7e1b8e909b9c2a65d9d22b19884d1969bca5c581 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sun, 15 Apr 2007 05:32:18 +0000 Subject: More perl-like idioms for generating regdis.c - Don't use an advancing counter through an array to do a push(). - An empty array is written as (), not 0. --- regs.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/regs.pl b/regs.pl index 58354932..b5c7e495 100755 --- a/regs.pl +++ b/regs.pl @@ -102,12 +102,10 @@ if ( $fmt eq 'h' ) { foreach $class ( sort(keys(%disclass)) ) { printf "static const int %-8s[] = {", $class; @foo = @{$disclass{$class}}; - @bar = 0; - $counter = 0; + @bar = (); for ( $i = 0 ; $i < scalar(@foo) ; $i++ ) { if (defined($foo[$i])) { - $bar[$counter] = "R_\U$foo[$i]\E"; - $counter ++; + push(@bar, "R_\U$foo[$i]\E"); } } print join(',', @bar), "};\n"; -- cgit v1.2.1