This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Refactor if-else series
authorKarl Williamson <public@khwilliamson.com>
Fri, 27 Jan 2012 04:01:33 +0000 (21:01 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 4 Feb 2012 23:29:30 +0000 (16:29 -0700)
This is a slight refactoring to avoid using 'next' in the loop, and to
surround things with a bare block.  Future commits will want to
do common code at the bottom of the loop, including a redo of the bare
block.

lib/unicore/mktables

index 24cf411..5755e0a 100644 (file)
@@ -5257,6 +5257,8 @@ END
                 next RANGE if defined $suppress_value
                               && $value eq $suppress_value;
 
+                {
+
                 # If there is a range and doesn't need a single point range
                 # output
                 if ($start != $end && ! $range_size_1) {
@@ -5281,13 +5283,11 @@ END
                                             $count);
                         $OUT[-1] = Text::Tabs::unexpand($OUT[-1]);
                     }
-                    next RANGE;
                 }
 
-                # Here to output a single code point per line
-
-                # If not to annotate, use the simple formats
-                if (! $annotate) {
+                    # Here to output a single code point per line.
+                    # If not to annotate, use the simple formats
+                elsif (! $annotate) {
 
                     # Use any passed in subroutine to output.
                     if (ref $range_size_1 eq 'CODE') {
@@ -5302,8 +5302,8 @@ END
                             push @OUT, sprintf "%04X\t\t%s\n", $i, $value;
                         }
                     }
-                    next RANGE;
                 }
+                else {
 
                 # Here, wants annotation.
                 for (my $i = $start; $i <= $end; $i++) {
@@ -5442,6 +5442,8 @@ END
                         $OUT[-1] .= "\n";
                     }
                 }
+                }
+                }
             } # End of loop through all the table's ranges
         }