From: Ilya Zakharevich Date: Wed, 10 Jun 1998 11:38:58 +0000 (-0400) Subject: back out change#1111 and add alternative patch: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9277f475182e73cbf77386678e16ed5037ab2bb;p=p5sagit%2Fp5-mst-13.2.git back out change#1111 and add alternative patch: Message-Id: <199806101538.LAA07293@monk.mps.ohio-state.edu> Subject: Re: PATCH for study/foo/ p4raw-link: @1111 on //depot/perl: 20e9db593ef4f0b3ec4e4dbedd03ab5782525eaf p4raw-id: //depot/perl@1114 --- diff --git a/pp.c b/pp.c index c65ed1c..aeaca4c 100644 --- a/pp.c +++ b/pp.c @@ -604,11 +604,8 @@ PP(pp_study) if(unop->op_first && unop->op_first->op_type == OP_PUSHRE) { PMOP *pm = (PMOP *)unop->op_first; SV *rv = sv_newmortal(); - REGEXP *re = pm->op_pmregexp; - sv = newSVrv(rv, "Regexp"); - sv_setpvn(sv,re->precomp,re->prelen); - sv_magic(sv,(SV*)ReREFCNT_inc(re),'r',0,0); + sv_magic(sv,(SV*)ReREFCNT_inc(pm->op_pmregexp),'r',0,0); RETURNX(PUSHs(rv)); } diff --git a/sv.c b/sv.c index f098efa..8c7d9c2 100644 --- a/sv.c +++ b/sv.c @@ -1696,7 +1696,21 @@ sv_2pv(register SV *sv, STRLEN *lp) if (!sv) s = "NULLREF"; else { + MAGIC *mg; + switch (SvTYPE(sv)) { + case SVt_PVMG: + if ( ((SvFLAGS(sv) & + (SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG)) + == (SVs_OBJECT|SVs_RMG)) + && strEQ(s=HvNAME(SvSTASH(sv)), "Regexp") + && (mg = mg_find(sv, 'r'))) { + regexp *re = (regexp *)mg->mg_obj; + + *lp = re->prelen; + return re->precomp; + } + /* Fall through */ case SVt_NULL: case SVt_IV: case SVt_NV: @@ -1704,8 +1718,7 @@ sv_2pv(register SV *sv, STRLEN *lp) case SVt_PV: case SVt_PVIV: case SVt_PVNV: - case SVt_PVBM: - case SVt_PVMG: s = "SCALAR"; break; + case SVt_PVBM: s = "SCALAR"; break; case SVt_PVLV: s = "LVALUE"; break; case SVt_PVAV: s = "ARRAY"; break; case SVt_PVHV: s = "HASH"; break;