From abe611dc12016e9d0b52fe15538cc2ffad071663 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 11 Feb 2024 16:36:16 -0800 Subject: [PATCH] elimininate wantarray Now only the final debug return uses wantarray --- lib/Perl/Tidy.pm | 10 +++++----- lib/Perl/Tidy/Formatter.pm | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index dde9e0c7..2fe8e380 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -3126,9 +3126,9 @@ sub line_diff { my ( $s1, $s2 ) = @_; - # Given two strings, return - # $diff_marker = a string with carat (^) symbols indicating differences - # $pos1 = character position of first difference; pos1=-1 if no difference + # Given two strings, Return + # $diff_marker = a string with carat (^) symbols indicating differences + # $pos1 = character position of first difference; pos1=-1 if no difference # Form exclusive or of the strings, which has null characters where strings # have same common characters so non-null characters indicate character @@ -3151,7 +3151,7 @@ sub line_diff { last; } } - return wantarray ? ( $diff_marker, $pos1 ) : $diff_marker; + return ( $diff_marker, $pos1 ); } ## end sub line_diff sub compare_string_buffers { @@ -5512,7 +5512,7 @@ sub Win_Config_Locs { "I dont know a sensible place to look for config files on an $os system.\n"; return; } - return wantarray ? ( $os, $system, $allusers ) : $os; + return ( $os, $system, $allusers ); } ## end sub Win_Config_Locs sub dump_config_file { diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 4dd82808..17077de3 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -21451,10 +21451,12 @@ EOM sub terminal_type_i { - # returns type of last token on this line (terminal token), as follows: - # returns # for a full-line comment - # returns ' ' for a blank line - # otherwise returns final token type + # Given: + # ($ibeg, $iend) = index range of the current output buffer line + # Returns type of last token on this line (terminal token), as follows: + # # for a full-line comment + # ' ' for a blank line + # otherwise returns final token type my ( $ibeg, $iend ) = @_; @@ -21466,7 +21468,7 @@ sub terminal_type_i { if ( $type_i eq '#' ) { $i--; if ( $i < $ibeg ) { - return wantarray ? ( $type_i, $ibeg ) : $type_i; + return $type_i; } $type_i = $types_to_go[$i]; } @@ -21475,7 +21477,7 @@ sub terminal_type_i { if ( $type_i eq 'b' ) { $i--; if ( $i < $ibeg ) { - return wantarray ? ( $type_i, $ibeg ) : $type_i; + return $type_i; } $type_i = $types_to_go[$i]; } @@ -21492,7 +21494,7 @@ sub terminal_type_i { { $type_i = 'b'; } - return wantarray ? ( $type_i, $i ) : $type_i; + return $type_i; } ## end sub terminal_type_i sub pad_array_to_go { -- 2.39.5