diff options
author | Radu Greab <radu@netsoft.ro> | 2001-07-15 07:50:06 +0300 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-07-16 13:52:49 +0000 |
commit | 70612e96eacfe1d980494617b001dbed7e9eee65 (patch) | |
tree | 0efe4b6ca534f04332c7f75859db18e406e4f0c9 /sv.c | |
parent | 67fc2416631ce1ddf0bbad56564533900de2f291 (diff) | |
download | perl-70612e96eacfe1d980494617b001dbed7e9eee65.tar.gz |
re_dup
Message-Id: <15184.63182.656988.340591@ix.netsoft.ro>
p4raw-id: //depot/perl@11382
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -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; } |