summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-02 12:06:05 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-02 12:06:05 +0000
commit07bc277f32c1d7aff237dd3f55d558b5d4b93314 (patch)
tree86a4a36156c095e618d07cc5cb6d35875496d75f /regcomp.c
parent3d66076ad00dfe06380fb774b92fb59dc07fe4ec (diff)
downloadperl-07bc277f32c1d7aff237dd3f55d558b5d4b93314.tar.gz
Wrap all deferences of struct regexp* in macros RX_*() [and for
regcomp.c and regexec.c RXp_* where necessary] so that in future we can maintain source compatibility when we add an extra level of dereferencing. p4raw-id: //depot/perl@32802
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/regcomp.c b/regcomp.c
index 10e63f5129..3612dcac76 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(r) = plen + has_minus + has_p + has_runon
+ RXp_WRAPLEN(r) = plen + has_minus + has_p + has_runon
+ (sizeof(STD_PAT_MODS) - 1)
+ (sizeof("(?:)") - 1);
- Newx(RX_WRAPPED(r), RX_WRAPLEN(r) + 1, char );
- p = RX_WRAPPED(r);
+ Newx(RXp_WRAPPED(r), RXp_WRAPLEN(r) + 1, char );
+ p = RXp_WRAPPED(r);
*p++='('; *p++='?';
if (has_p)
*p++ = KEEPCOPY_PAT_MOD; /*'p'*/
@@ -4319,8 +4319,8 @@ redo_first_pass:
*p++ = ':';
Copy(RExC_precomp, p, plen, char);
- assert ((RX_WRAPPED(r) - p) < 16);
- r->pre_prefix = p - RX_WRAPPED(r);
+ assert ((RXp_WRAPPED(r) - p) < 16);
+ r->pre_prefix = p - RXp_WRAPPED(r);
p += plen;
if (has_runon)
*p++ = '\n';
@@ -4797,15 +4797,15 @@ reStudy:
#ifdef STUPID_PATTERN_CHECKS
if (RX_PRELEN(r) == 0)
r->extflags |= RXf_NULL;
- if (r->extflags & RXf_SPLIT && RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == ' ')
+ if (r->extflags & RXf_SPLIT && RX_PRELEN(r) == 1 && RXp_PRECOMP(r)[0] == ' ')
/* XXX: this should happen BEFORE we compile */
r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
- else if (RX_PRELEN(r) == 3 && memEQ("\\s+", RX_PRECOMP(r), 3))
+ else if (RX_PRELEN(r) == 3 && memEQ("\\s+", RXp_PRECOMP(r), 3))
r->extflags |= RXf_WHITE;
- else if (RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == '^')
+ else if (RX_PRELEN(r) == 1 && RXp_PRECOMP(r)[0] == '^')
r->extflags |= RXf_START_ONLY;
#else
- if (r->extflags & RXf_SPLIT && RX_PRELEN(r) == 1 && RX_PRECOMP(r)[0] == ' ')
+ if (r->extflags & RXf_SPLIT && RXp_PRELEN(r) == 1 && RXp_PRECOMP(r)[0] == ' ')
/* XXX: this should happen BEFORE we compile */
r->extflags |= (RXf_SKIPWHITE|RXf_WHITE);
else {
@@ -5103,16 +5103,16 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEXP * const rx, const I32 paren, SV * cons
sv_setpvn(sv, s, i);
PL_tainted = oldtainted;
if ( (rx->extflags & RXf_CANY_SEEN)
- ? (RX_MATCH_UTF8(rx)
+ ? (RXp_MATCH_UTF8(rx)
&& (!i || is_utf8_string((U8*)s, i)))
- : (RX_MATCH_UTF8(rx)) )
+ : (RXp_MATCH_UTF8(rx)) )
{
SvUTF8_on(sv);
}
else
SvUTF8_off(sv);
if (PL_tainting) {
- if (RX_MATCH_TAINTED(rx)) {
+ if (RXp_MATCH_TAINTED(rx)) {
if (SvTYPE(sv) >= SVt_PVMG) {
MAGIC* const mg = SvMAGIC(sv);
MAGIC* mgt;
@@ -5194,7 +5194,7 @@ Perl_reg_numbered_buff_length(pTHX_ REGEXP * const rx, const SV * const sv,
}
}
getlen:
- if (i > 0 && RX_MATCH_UTF8(rx)) {
+ if (i > 0 && RXp_MATCH_UTF8(rx)) {
const char * const s = rx->subbeg + s1;
const U8 *ep;
STRLEN el;
@@ -9147,7 +9147,7 @@ Perl_pregfree(pTHX_ struct regexp *r)
CALLREGFREE_PVT(r); /* free the private data */
if (r->paren_names)
SvREFCNT_dec(r->paren_names);
- Safefree(RX_WRAPPED(r));
+ Safefree(RXp_WRAPPED(r));
}
if (r->substrs) {
if (r->anchored_substr)
@@ -9245,7 +9245,7 @@ Perl_regfree_internal(pTHX_ REGEXP * const r)
{
SV *dsv= sv_newmortal();
RE_PV_QUOTED_DECL(s, (r->extflags & RXf_UTF8),
- dsv, RX_PRECOMP(r), RX_PRELEN(r), 60);
+ dsv, RXp_PRECOMP(r), RXp_PRELEN(r), 60);
PerlIO_printf(Perl_debug_log,"%sFreeing REx:%s %s\n",
PL_colors[4],PL_colors[5],s);
}
@@ -9420,7 +9420,7 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param)
}
}
- RX_WRAPPED(ret) = SAVEPVN(RX_WRAPPED(ret), RX_WRAPLEN(ret)+1);
+ RXp_WRAPPED(ret) = SAVEPVN(RXp_WRAPPED(ret), RXp_WRAPLEN(ret)+1);
ret->paren_names = hv_dup_inc(ret->paren_names, param);
if (ret->pprivate)
@@ -9584,9 +9584,9 @@ Perl_reg_stringify(pTHX_ MAGIC *mg, STRLEN *lp, U32 *flags, I32 *haseval ) {
dVAR;
const regexp * const re = (regexp *)mg->mg_obj;
if (haseval)
- *haseval = re->seen_evals;
+ *haseval = RX_SEEN_EVALS(re);
if (flags)
- *flags = ((re->extflags & RXf_UTF8) ? 1 : 0);
+ *flags = ((RX_EXTFLAGS(re) & RXf_UTF8) ? 1 : 0);
if (lp)
*lp = RX_WRAPLEN(re);
return RX_WRAPPED(re);
@@ -9682,7 +9682,7 @@ Perl_save_re_context(pTHX)
const REGEXP * const rx = PM_GETRE(PL_curpm);
if (rx) {
U32 i;
- for (i = 1; i <= rx->nparens; i++) {
+ for (i = 1; i <= RX_NPARENS(rx); i++) {
char digits[TYPE_CHARS(long)];
const STRLEN len = my_snprintf(digits, sizeof(digits), "%lu", (long)i);
GV *const *const gvp