This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix escaping in opcode.h generation
authorDagfinn Ilmari Mannsåker (via RT) <perlbug-followup@perl.org>
Mon, 23 Aug 2010 23:05:48 +0000 (16:05 -0700)
committerDavid Mitchell <davem@iabyn.com>
Wed, 25 Aug 2010 17:34:51 +0000 (18:34 +0100)
The op list has no escapes, so there's no need check for already-escaped
characters, and the existing regex breaks any run of consecutive
backslashes, escaped or not.

opcode.pl

index 1dadb53..1b8c688 100755 (executable)
--- a/opcode.pl
+++ b/opcode.pl
@@ -209,7 +209,7 @@ for (@ops) {
     my($safe_desc) = $desc{$_};
 
     # Have to escape double quotes and escape characters.
-    $safe_desc =~ s/(^|[^\\])([\\"])/$1\\$2/g;
+    $safe_desc =~ s/([\\"])/\\$1/g;
 
     print qq(\t"$safe_desc",\n);
 }