From: Nicholas Clark Date: Fri, 28 Dec 2007 23:17:20 +0000 (+0000) Subject: Eliminate prelen from struct regexp. Possibly we are hardcoding a bit X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=51aa200460138e2cc5ab024c9216177298546e81;p=p5sagit%2Fp5-mst-13.2.git Eliminate prelen from struct regexp. Possibly we are hardcoding a bit to much, as the replacement assumes that the wrapping string has exactly 1 character after the wrapped string [specifically ')']. p4raw-id: //depot/perl@32757 --- diff --git a/regcomp.c b/regcomp.c index 5c7ee09..ff099f5 100644 --- a/regcomp.c +++ b/regcomp.c @@ -4281,7 +4281,6 @@ redo_first_pass: RXi_SET( r, ri ); r->engine= RE_ENGINE_PTR; r->refcnt = 1; - RX_PRELEN(r) = plen; r->extflags = pm_flags; { bool has_p = ((r->extflags & RXf_PMf_KEEPCOPY) == RXf_PMf_KEEPCOPY); diff --git a/regexp.h b/regexp.h index 5b58697..37d92c5 100644 --- a/regexp.h +++ b/regexp.h @@ -98,7 +98,6 @@ typedef struct regexp { /* Information about the match that isn't often used */ - I32 prelen; /* length of precomp */ /* wrapped can't be const char*, as it is returned by sv_2pv_flags */ char *wrapped; /* wrapped version of the pattern */ I32 wraplen; /* length of wrapped */ @@ -355,7 +354,10 @@ and check for NULL. /* For source compatibility. We used to store these explicitly. */ #define RX_PRECOMP(prog) ((prog)->wrapped + (prog)->pre_prefix) -#define RX_PRELEN(prog) ((prog)->prelen) +/* FIXME? Are we hardcoding too much here and constraining plugin extension + writers? Specifically, the value 1 assumes that the wrapped version always + has exactly one character at the end, a ')'. Will that always be true? */ +#define RX_PRELEN(prog) ((prog)->wraplen - (prog)->pre_prefix - 1) #endif /* PLUGGABLE_RE_EXTENSION */