From: Nicholas Clark Date: Sat, 5 Jan 2008 15:02:25 +0000 (+0000) Subject: Abolish wraplen from struct regexp. We're already storing it in SvCUR. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d17798df32f4f48ca213b9ca03a2278ced586f5;p=p5sagit%2Fp5-mst-13.2.git Abolish wraplen from struct regexp. We're already storing it in SvCUR. p4raw-id: //depot/perl@32845 --- diff --git a/regcomp.c b/regcomp.c index 3c9915f..48822a6 100644 --- 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; - 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); - 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) diff --git a/regexp.h b/regexp.h index bae20d5..79bcacd 100644 --- a/regexp.h +++ b/regexp.h @@ -100,7 +100,6 @@ typedef struct regexp { /* 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 */ @@ -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) -#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)