aboutsummaryrefslogtreecommitdiffstats
path: root/tools/fix-encoding-args.pl
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-09-22 10:26:33 -0400
committerBill Meier <wmeier@newsguy.com>2014-09-22 14:32:16 +0000
commit19d55ca5a2f83b0711dbcf6b7ea5393d0dd534b1 (patch)
tree68d0e705a986dc5e134146b96fb7d4b54cce364b /tools/fix-encoding-args.pl
parentaac1cb28f65a2f3d2a8c721883aaaec9c59ecb50 (diff)
fix-encoding-args.pl: Don't use a feature available only starting with perl 5.14
Specifically: Window msys git uses an earlier version of Perl (5.8) and thus invoking fix-encoding-args.pl in the pre-commit hook script gives a Perl syntax error. See https://code.wireshark.org/review/4172 for details (Also see following for Perl info: http://www.perl.com/pub/2011/05/new-features-of-perl-514-non-destructive-substitution.html) Change-Id: I95a222eaa31942cc6e873ffbde57c5fa5bd2a625 Reviewed-on: https://code.wireshark.org/review/4245 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'tools/fix-encoding-args.pl')
-rwxr-xr-xtools/fix-encoding-args.pl9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/fix-encoding-args.pl b/tools/fix-encoding-args.pl
index 59e3e78538..dd1d4300a2 100755
--- a/tools/fix-encoding-args.pl
+++ b/tools/fix-encoding-args.pl
@@ -456,8 +456,7 @@ sub find_hf_array_entries {
# keys in the searchReplace hash.
# Escape any "|" characters in the keys
# and then create "alternatives" string containing all the resulting key strings. Ex: "(A|B|C\|D|..."
- # (Note 'r' modifier in the following causes s{}{} to return a (modified) *copy* of $_)
- $encArgPat = join "|", map { s{ ( \| ) }{\\$1}grx } keys %$searchReplaceHRef;
+ $encArgPat = join "|", map { my $copy = $_; $copy =~ s{ ( \| ) }{\\$1}gx; $copy } keys %$searchReplaceHRef;
} elsif ($subFlag == 3) {
# match for <fcn_name>() statements for any value of the encoding parameter
# IOW: find all the <fcn_name> statements
@@ -560,8 +559,7 @@ sub find_hf_array_entries {
# keys in the searchReplace hash.
# Escape any "|" characters in the keys
# and then create "alternatives" string containing all the resulting key strings. Ex: "A|B|C\|D|..."
- # (Note 'r' modifier in the following causes s{}{} to return a (modified) *copy* of $_)
- $encArgPat = join "|", map { s{ ( \| ) }{\\$1}grx } keys %$searchReplaceHRef;
+ $encArgPat = join "|", map { my $copy = $_; $copy =~ s{ ( \| ) }{\\$1}gx; $copy } keys %$searchReplaceHRef;
} elsif ($subFlag == 2) {
# Find all the <fcn_name>() statements wherein the encoding arg is a value other than
# one of the "replace" values.
@@ -569,8 +567,7 @@ sub find_hf_array_entries {
# arg is something other than one of the the provided replace values.
# Escape any "|" characters in the values to be matched
# and then create "alternatives" string containing all the value strings. Ex: "A|B|C\|D|..."
- # (Note 'r' modifier in the following causes s{}{} to return a (modified) *copy* of $_)
- my $match_str = join "|", map { s{ ( \| ) }{\\$1}grx } values %$searchReplaceHRef;
+ my $match_str = join "|", map { my $copy = $_; $copy =~ s{ ( \| ) }{\\$1}gx; $copy } values %$searchReplaceHRef;
$encArgPat = qr /
(?! # negative zero-length look-ahead
\s*