Skip to content

Commit 5f139a1

Browse files
bk2204ttaylorr
authored andcommitted
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 <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent 702d8c1 commit 5f139a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ sub evaluate_and_validate_params {
11881188
if ($search_use_regexp) {
11891189
$search_regexp = $searchtext;
11901190
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;
11921192
die_error(400, "Invalid search regexp '$search_regexp'",
11931193
esc_html($error));
11941194
}
@@ -2700,7 +2700,7 @@ sub git_cmd {
27002700
# Try to avoid using this function wherever possible.
27012701
sub quote_command {
27022702
return join(' ',
2703-
map { my $a = $_; $a =~ s/(['!])/'\\$1'/g; "'$a'" } @_ );
2703+
map { my $a = $_ =~ s/(['!])/'\\$1'/gr; "'$a'" } @_ );
27042704
}
27052705

27062706
# get HEAD ref of given project as hash

0 commit comments

Comments
 (0)