gitweb: make use of s///r

In Perl 5.14, released in May 2011, the r modifier was added to the s/// operator to allow it to return the modified string instead of modifying the string in place. This allows to write nicer, more succinct code in several cases, so let's do that here. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Taylor Blau <me@ttaylorr.com>

brian m. carlson committed Oct 23, 2024 at 00:46 UTC 5f139a194f22b34eb49a891253271693989d6fdc
1 file changed +2 -2
gitweb/gitweb.perl
+2 -2
@@ -1188,7 +1188,7 @@ sub evaluate_and_validate_params {
1188 if ($search_use_regexp) {
1189 $search_regexp = $searchtext;
1190 if (!eval { qr/$search_regexp/; 1; }) {
1191 - (my $error = $@) =~ s/ at \S+ line \d+.*\n?//;
1191 + my $error = $@ =~ s/ at \S+ line \d+.*\n?//r;
1192 die_error(400, "Invalid search regexp '$search_regexp'",
1193 esc_html($error));
1194 }
@@ -2700,7 +2700,7 @@ sub git_cmd {
2700 # Try to avoid using this function wherever possible.
2701 sub quote_command {
2702 return join(' ',
2703 - map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
2703 + map { my $a = $_ =~ s/(['!])/'\\$1'/gr; "'$a'" } @_ );
2704 }
2705
2706 # get HEAD ref of given project as hash