This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In embed.pl, simplify the code that parses regen/opcodes.
authorNicholas Clark <nick@ccl4.org>
Sun, 21 Aug 2011 11:29:26 +0000 (13:29 +0200)
committerNicholas Clark <nick@ccl4.org>
Thu, 25 Aug 2011 09:34:36 +0000 (11:34 +0200)
As @embed is sorted later, the order that we add entries to it doesn't matter.
Hence add them immediately, avoiding the need to iterate over the "seen" hash.

regen/embed.pl

index 5be3744..681c99c 100755 (executable)
@@ -92,12 +92,10 @@ open IN, 'regen/opcodes' or die $!;
        next unless $_;
        next if /^#/;
        my (undef, undef, $check) = split /\t+/, $_;
-       ++$syms{$check};
-    }
+       next if $syms{$check}++;
 
-    foreach (keys %syms) {
        # These are all indirectly referenced by globals.c.
-       push @embed, ['pR', 'OP *', $_, 'NN OP *o'];
+       push @embed, ['pR', 'OP *', $check, 'NN OP *o'];
     }
 }
 close IN;