]> git.donarmstrong.com Git - perltidy.git/commitdiff
remove unused code
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 2 Apr 2023 23:34:44 +0000 (16:34 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 2 Apr 2023 23:34:44 +0000 (16:34 -0700)
lib/Perl/Tidy.pm
lib/Perl/Tidy/VerticalAligner.pm

index 2b66e2f9837418f4c2e9ad1d609f751f5bf1338b..9d1fd4c9ad77b04f0d4e099fefd01deac540d016 100644 (file)
@@ -563,6 +563,8 @@ sub perltidy {
     $Warn_count = 0;
 
     # don't overwrite callers ARGV
+    # Localization of @ARGV could be avoided by calling GetOptionsFromArray
+    # instead of GetOptions, but that is not available before perl 5.10
     local @ARGV   = @ARGV;
     local *STDERR = *STDERR;
 
index 09f3c20e6b405ebd478db896ba0ba0fd5d271ec2..d008cd52f546cf6058d4c8af9c89930d4c668bfe 100644 (file)
@@ -325,7 +325,6 @@ sub new {
     # Initialize other caches and buffers
     initialize_step_B_cache();
     initialize_valign_buffer();
-    initialize_leading_string_cache();
     initialize_decode();
     set_logger_object( $args{logger_object} );
 
@@ -1557,8 +1556,6 @@ sub _flush_comment_lines {
     my $group_level               = $self->[_group_level_];
     my $group_maximum_line_length = $self->[_group_maximum_line_length_];
     my $leading_space_count       = $self->[_comment_leading_space_count_];
-##  my $leading_string =
-##    $self->get_leading_string( $leading_space_count, $group_level );
 
     # look for excessively long lines
     my $max_excess = 0;
@@ -5588,80 +5585,6 @@ sub valign_output_step_D {
     return;
 } ## end sub valign_output_step_D
 
-{    ## closure for sub get_leading_string
-
-    my @leading_string_cache;
-
-    sub initialize_leading_string_cache {
-        @leading_string_cache = ();
-        return;
-    }
-
-    sub get_leading_string {
-
-        # define the leading whitespace string for this line..
-        my ( $self, $leading_whitespace_count, $group_level ) = @_;
-
-        # Handle case of zero whitespace, which includes multi-line quotes
-        # (which may have a finite level; this prevents tab problems)
-        if ( $leading_whitespace_count <= 0 ) {
-            return EMPTY_STRING;
-        }
-
-        # look for previous result
-        elsif ( $leading_string_cache[$leading_whitespace_count] ) {
-            return $leading_string_cache[$leading_whitespace_count];
-        }
-
-        # must compute a string for this number of spaces
-        my $leading_string;
-
-        # Handle simple case of no tabs
-        my $rOpts_indent_columns = $self->[_rOpts_indent_columns_];
-        my $rOpts_tabs           = $self->[_rOpts_tabs_];
-        my $rOpts_entab_leading_whitespace =
-          $self->[_rOpts_entab_leading_whitespace_];
-
-        if ( !( $rOpts_tabs || $rOpts_entab_leading_whitespace )
-            || $rOpts_indent_columns <= 0 )
-        {
-            $leading_string = ( SPACE x $leading_whitespace_count );
-        }
-
-        # Handle entab option
-        elsif ($rOpts_entab_leading_whitespace) {
-            my $space_count =
-              $leading_whitespace_count % $rOpts_entab_leading_whitespace;
-            my $tab_count = int(
-                $leading_whitespace_count / $rOpts_entab_leading_whitespace );
-            $leading_string = "\t" x $tab_count . SPACE x $space_count;
-        }
-
-        # Handle option of one tab per level
-        else {
-            $leading_string = ( "\t" x $group_level );
-            my $space_count =
-              $leading_whitespace_count - $group_level * $rOpts_indent_columns;
-
-            # shouldn't happen:
-            if ( $space_count < 0 ) {
-                DEBUG_TABS
-                  && warning(
-"Error in get_leading_string: for level=$group_level count=$leading_whitespace_count\n"
-                  );
-
-                # -- skip entabbing
-                $leading_string = ( SPACE x $leading_whitespace_count );
-            }
-            else {
-                $leading_string .= ( SPACE x $space_count );
-            }
-        }
-        $leading_string_cache[$leading_whitespace_count] = $leading_string;
-        return $leading_string;
-    } ## end sub get_leading_string
-} ## end get_leading_string
-
 ##########################
 # CODE SECTION 10: Summary
 ##########################