This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use the PERL_PV_PRETTY_NOCLEAR flag to simplify the code in
authorNicholas Clark <nick@ccl4.org>
Sat, 6 Oct 2007 15:04:53 +0000 (15:04 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 6 Oct 2007 15:04:53 +0000 (15:04 +0000)
Perl_regprop() for the EXACT node case.

p4raw-id: //depot/perl@32049

regcomp.c

index 2af7958..d12f18b 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -8805,19 +8805,17 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
     k = PL_regkind[OP(o)];
 
     if (k == EXACT) {
-       SV * const dsv = sv_2mortal(newSVpvs(""));
+       sv_catpvs(sv, " ");
        /* Using is_utf8_string() (via PERL_PV_UNI_DETECT) 
         * is a crude hack but it may be the best for now since 
         * we have no flag "this EXACTish node was UTF-8" 
         * --jhi */
-       const char * const s = 
-           pv_pretty(dsv, STRING(o), STR_LEN(o), 60, 
-               PL_colors[0], PL_colors[1],
-               PERL_PV_ESCAPE_UNI_DETECT |
-               PERL_PV_PRETTY_ELLIPSES   |
-               PERL_PV_PRETTY_LTGT    
-            ); 
-       Perl_sv_catpvf(aTHX_ sv, " %s", s );
+       pv_pretty(sv, STRING(o), STR_LEN(o), 60, PL_colors[0], PL_colors[1],
+                 PERL_PV_ESCAPE_UNI_DETECT |
+                 PERL_PV_PRETTY_ELLIPSES   |
+                 PERL_PV_PRETTY_LTGT       |
+                 PERL_PV_PRETTY_NOCLEAR
+                 );
     } else if (k == TRIE) {
        /* print the details of the trie in dumpuntil instead, as
         * progi->data isn't available here */