This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Abolish wraplen from struct regexp. We're already storing it in SvCUR.
authorNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 15:02:25 +0000 (15:02 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 5 Jan 2008 15:02:25 +0000 (15:02 +0000)
p4raw-id: //depot/perl@32845

regcomp.c
regexp.h

index 3c9915f..48822a6 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -4290,12 +4290,12 @@ redo_first_pass:
                            >> RXf_PMf_STD_PMMOD_SHIFT);
        const char *fptr = STD_PAT_MODS;        /*"msix"*/
        char *p;
                            >> RXf_PMf_STD_PMMOD_SHIFT);
        const char *fptr = STD_PAT_MODS;        /*"msix"*/
        char *p;
-        RX_WRAPLEN(rx) = plen + has_minus + has_p + has_runon
+       const STRLEN wraplen = plen + has_minus + has_p + has_runon
             + (sizeof(STD_PAT_MODS) - 1)
             + (sizeof("(?:)") - 1);
 
             + (sizeof(STD_PAT_MODS) - 1)
             + (sizeof("(?:)") - 1);
 
-       p = sv_grow(rx, RX_WRAPLEN(rx) + 1);
-       SvCUR_set(rx, RX_WRAPLEN(rx));
+       p = sv_grow(rx, wraplen + 1);
+       SvCUR_set(rx, wraplen);
        SvPOK_on(rx);
         *p++='('; *p++='?';
         if (has_p)
        SvPOK_on(rx);
         *p++='('; *p++='?';
         if (has_p)
index bae20d5..79bcacd 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -100,7 +100,6 @@ typedef struct regexp {
         
         
         /* Information about the match that isn't often used */
         
         
         /* Information about the match that isn't often used */
-       I32 wraplen;            /* length of wrapped */
        unsigned pre_prefix:4;  /* offset from wrapped to the start of precomp */
        unsigned seen_evals:28; /* number of eval groups in the pattern - for security checks */ 
         HV *paren_names;       /* Optional hash of paren names */
        unsigned pre_prefix:4;  /* offset from wrapped to the start of precomp */
        unsigned seen_evals:28; /* number of eval groups in the pattern - for security checks */ 
         HV *paren_names;       /* Optional hash of paren names */
@@ -365,7 +364,7 @@ and check for NULL.
    has exactly one character at the end, a ')'. Will that always be true?  */
 #define RX_PRELEN(prog)                (RX_WRAPLEN(prog) - ((struct regexp *)SvANY(prog))->pre_prefix - 1)
 #define RX_WRAPPED(prog)       SvPVX(prog)
    has exactly one character at the end, a ')'. Will that always be true?  */
 #define RX_PRELEN(prog)                (RX_WRAPLEN(prog) - ((struct regexp *)SvANY(prog))->pre_prefix - 1)
 #define RX_WRAPPED(prog)       SvPVX(prog)
-#define RX_WRAPLEN(prog)       (((struct regexp *)SvANY(prog))->wraplen)
+#define RX_WRAPLEN(prog)       SvCUR(prog)
 #define RX_CHECK_SUBSTR(prog)  (((struct regexp *)SvANY(prog))->check_substr)
 #define RX_EXTFLAGS(prog)      RXp_EXTFLAGS((struct regexp *)SvANY(prog))
 #define RX_REFCNT(prog)                SvREFCNT(prog)
 #define RX_CHECK_SUBSTR(prog)  (((struct regexp *)SvANY(prog))->check_substr)
 #define RX_EXTFLAGS(prog)      RXp_EXTFLAGS((struct regexp *)SvANY(prog))
 #define RX_REFCNT(prog)                SvREFCNT(prog)