This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Use hash instead of grep the keys
authorKarl Williamson <public@khwilliamson.com>
Wed, 12 Oct 2011 00:05:24 +0000 (18:05 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 8 Nov 2011 15:09:26 +0000 (08:09 -0700)
It doesn't make sense to grep the keys, when you can just look up the
key in the hash.

lib/unicore/mktables

index b9c2a63..e05751b 100644 (file)
@@ -14081,8 +14081,8 @@ sub write_all_tables() {
 
             # See if should suppress the table if is empty, but warn if it
             # contains something.
-            my $suppress_if_empty_warn_if_not = grep { $complete_name eq $_ }
-                                    keys %why_suppress_if_empty_warn_if_not;
+            my $suppress_if_empty_warn_if_not
+                    = $why_suppress_if_empty_warn_if_not{$complete_name} || 0;
 
             # Calculate if this table should have any code points associated
             # with it or not.
@@ -14137,7 +14137,7 @@ sub write_all_tables() {
 
                 if ($suppress_if_empty_warn_if_not) {
                     $table->set_status($SUPPRESSED,
-                        $why_suppress_if_empty_warn_if_not{$complete_name});
+                                       $suppress_if_empty_warn_if_not);
                 }
 
                 # Suppress (by skipping them) expected empty tables.
@@ -14161,7 +14161,7 @@ sub write_all_tables() {
             elsif ($expected_empty) {
                 my $because = "";
                 if ($suppress_if_empty_warn_if_not) {
-                    $because = " because $why_suppress_if_empty_warn_if_not{$complete_name}";
+                    $because = " because $suppress_if_empty_warn_if_not";
                 }
 
                 Carp::my_carp("Not expecting property $table$because.  Generating file for it anyway.");