Skip to content

Commit 44dfaa0

Browse files
committed
rename: don't greedily match in the ifdef
1 parent 65dce6f commit 44dfaa0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

rename.pl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,22 @@ sub translate {
115115
$contents =~ s/adopt_/${prefix}_/g;
116116
$contents =~ s/ADOPT_/${prefix_upper}_/g;
117117

118-
$contents =~ s/fprintf\(file, "([A-Z])/fprintf\(file, "\l$1/g if($lowercase_status);
118+
$contents =~ s/fprintf\(file, "([A-Z])/fprintf\(file, "\l$1/g if($lowercase_status);
119119

120120
if ($include) {
121121
$contents =~ s/^(#include "opt.h")$/#include "${include}"\n$1/mg;
122122
}
123123

124124
if ($inline) {
125125
$contents =~ s/^INLINE/${inline}/mg;
126-
$contents =~ s/\n#ifdef _MSC_VER\n.*\n#endif\n//sg;
126+
$contents =~ s/\n#ifdef _MSC_VER\n.*?\n#endif\n//sg;
127127
}
128128

129129
if ($tests) {
130130
$contents =~ s/test_adopt__/test_${tests_name}__/g;
131131
}
132132

133-
$contents =~ s/\n \*\/\n/\n *\n * THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT.\n *\n * This file was produced by using the `rename.pl` script included with\n * adopt. The command-line specified was:\n *\n * $0 @ARGV\n *\/\n/s;
134-
135-
# $contents =~ s/\n\n/\n\n\/*\n * THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT.\n *\n * This file was produced by using the `rename.pl` script included with\n * adopt. The command-line specified was:\n *\n * $0 @ARGV\n *\/\n\n/s;
133+
$contents =~ s/\n \*\/\n/\n *\n * THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT.\n *\n * This file was produced by using the `rename.pl` script included with\n * adopt. The command-line specified was:\n *\n * $0 @ARGV\n *\/\n/s;
136134

137135
open(OUT, '>' . $out) || die "$0: could not open ${out}: $!\n";
138136
print OUT $contents;

0 commit comments

Comments
 (0)