From 70612e96eacfe1d980494617b001dbed7e9eee65 Mon Sep 17 00:00:00 2001 From: Radu Greab Date: Sun, 15 Jul 2001 07:50:06 +0300 Subject: [PATCH] re_dup Message-Id: <15184.63182.656988.340591@ix.netsoft.ro> p4raw-id: //depot/perl@11382 --- sv.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sv.c b/sv.c index 09832cf..f74adea 100644 --- a/sv.c +++ b/sv.c @@ -8366,13 +8366,6 @@ Perl_re_dup(pTHX_ REGEXP *r, clone_params *param) New(0, ret->endp, npar, I32); Copy(r->startp, ret->startp, npar, I32); - if (r->regstclass) { - New(0, ret->regstclass, 1, regnode); - StructCopy(r->regstclass, ret->regstclass, regnode); - } - else - ret->regstclass = NULL; - New(0, 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; @@ -8380,6 +8373,7 @@ Perl_re_dup(pTHX_ REGEXP *r, clone_params *param) s->substr = sv_dup_inc(r->substrs->data[i].substr, param); } + ret->regstclass = NULL; if (r->data) { struct reg_data *d; int count = r->data->count; @@ -8403,6 +8397,7 @@ Perl_re_dup(pTHX_ REGEXP *r, clone_params *param) New(0, d->data[i], 1, struct regnode_charclass_class); StructCopy(r->data->data[i], d->data[i], struct regnode_charclass_class); + ret->regstclass = (regnode*)d->data[i]; break; case 'o': case 'n': @@ -8420,8 +8415,6 @@ Perl_re_dup(pTHX_ REGEXP *r, clone_params *param) Copy(r->offsets, ret->offsets, 2*len+1, U32); ret->precomp = SAVEPV(r->precomp); - ret->subbeg = SAVEPV(r->subbeg); - ret->sublen = r->sublen; ret->refcnt = r->refcnt; ret->minlen = r->minlen; ret->prelen = r->prelen; @@ -8430,6 +8423,13 @@ Perl_re_dup(pTHX_ REGEXP *r, clone_params *param) ret->lastcloseparen = r->lastcloseparen; ret->reganch = r->reganch; + ret->sublen = r->sublen; + + if (RX_MATCH_COPIED(ret)) + ret->subbeg = SAVEPV(r->subbeg); + else + ret->subbeg = Nullch; + ptr_table_store(PL_ptr_table, r, ret); return ret; } -- 2.7.4