summaryrefslogtreecommitdiff
path: root/regs.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-04-15 05:32:18 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-04-15 05:32:18 +0000
commit7e1b8e909b9c2a65d9d22b19884d1969bca5c581 (patch)
treed96ceff85a71b1b0464e59cb8cf18733cc40834a /regs.pl
parentb7314d83f1464055f3f36e71b8aecb135db8e4ce (diff)
downloadnasm-7e1b8e909b9c2a65d9d22b19884d1969bca5c581.tar.gz
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.
Diffstat (limited to 'regs.pl')
-rwxr-xr-xregs.pl6
1 files 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";