From aac6dde014b9a309029437d5de76e303a474149c Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Wed, 6 Apr 2022 11:22:14 -0700 Subject: [PATCH] minor optimization --- lib/Perl/Tidy/Formatter.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index eecf0284..104e895b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -717,7 +717,6 @@ sub new { initialize_final_indentation_adjustment(); initialize_postponed_breakpoint(); initialize_batch_variables(); - initialize_forced_breakpoint_vars(); initialize_write_line(); my $vertical_aligner_object = Perl::Tidy::VerticalAligner->new( @@ -12165,8 +12164,10 @@ EOM # Called before the start of each new batch sub initialize_batch_variables { - $max_index_to_go = UNDEFINED_INDEX; - @summed_lengths_to_go = @nesting_depth_to_go = (0); + $max_index_to_go = UNDEFINED_INDEX; + $summed_lengths_to_go[0] = 0; + $nesting_depth_to_go[0] = 0; + ##@summed_lengths_to_go = @nesting_depth_to_go = (0); $ri_starting_one_line_block = []; # The initialization code for the remaining batch arrays is as follows @@ -12207,6 +12208,8 @@ EOM $index_start_one_line_block = UNDEFINED_INDEX; $semicolons_before_block_self_destruct = 0; + initialize_forced_breakpoint_vars(); + return; } @@ -12467,7 +12470,6 @@ EOM $self->[_this_batch_] = []; initialize_batch_variables(); - initialize_forced_breakpoint_vars(); return; } @@ -13979,7 +13981,7 @@ sub compare_indentation_levels { $forced_breakpoint_count = 0; $index_max_forced_break = UNDEFINED_INDEX; $forced_breakpoint_undo_count = 0; - @forced_breakpoint_undo_stack = (); + ##@forced_breakpoint_undo_stack = (); # not needed return; } -- 2.39.5