summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-12-05 17:13:36 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-12-05 15:39:39 +0000
commit785a26d510947a2b97507d7acf9b8c13bd59b310 (patch)
tree908a504a79042daa7102b33350bb3e41739ccc4f /regcomp.c
parent233e16ceab6589cdfcfeefabef027f39026bb05f (diff)
downloadperl-785a26d510947a2b97507d7acf9b8c13bd59b310.tar.gz
Further tweaks to make it easier to create regexp engine plug ins.
Message-ID: <9b18b3110612050713g77cac516x46fb5baac99b47c9@mail.gmail.com> (with tweaks) p4raw-id: //depot/perl@29468
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/regcomp.c b/regcomp.c
index b7510a9196..1611eb4405 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -8707,15 +8707,17 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param)
Newx(ret->endp, npar, I32);
Copy(r->endp, ret->endp, npar, I32);
- Newx(ret->substrs, 1, struct reg_substr_data);
- for (s = ret->substrs->data, i = 0; i < 3; i++, s++) {
- s->min_offset = r->substrs->data[i].min_offset;
- s->max_offset = r->substrs->data[i].max_offset;
- s->end_shift = r->substrs->data[i].end_shift;
- s->substr = sv_dup_inc(r->substrs->data[i].substr, param);
- s->utf8_substr = sv_dup_inc(r->substrs->data[i].utf8_substr, param);
- }
-
+ if (ret->substrs) {
+ Newx(ret->substrs, 1, struct reg_substr_data);
+ for (s = ret->substrs->data, i = 0; i < 3; i++, s++) {
+ s->min_offset = r->substrs->data[i].min_offset;
+ s->max_offset = r->substrs->data[i].max_offset;
+ s->end_shift = r->substrs->data[i].end_shift;
+ s->substr = sv_dup_inc(r->substrs->data[i].substr, param);
+ s->utf8_substr = sv_dup_inc(r->substrs->data[i].utf8_substr, param);
+ }
+ } else
+ ret->substrs = NULL;
ret->precomp = SAVEPVN(r->precomp, r->prelen);
ret->refcnt = r->refcnt;
@@ -8743,7 +8745,8 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param)
#endif
ret->pprivate = r->pprivate;
- RXi_SET(ret,CALLREGDUPE_PVT(ret,param));
+ if (ret->pprivate)
+ RXi_SET(ret,CALLREGDUPE_PVT(ret,param));
ptr_table_store(PL_ptr_table, r, ret);
return ret;