develooper Front page | perl.perl5.porters | Postings from August 2010

[perl #77400] [PATCH] Fix escaping in opcode.h generation

Thread Previous | Thread Next
From:
Dagfinn Ilmari Mannsåker
Date:
August 23, 2010 23:50
Subject:
[perl #77400] [PATCH] Fix escaping in opcode.h generation
Message ID:
rt-3.6.HEAD-5116-1282604748-116.77400-75-0@perl.org
# New Ticket Created by  Dagfinn Ilmari Mannsåker 
# Please include the string:  [perl #77400]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77400 >


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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/opcode.pl b/opcode.pl
index 1dadb53..1b8c688 100755
--- 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);
 }
-- 
1.7.0.4


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About