From: Nicholas Clark Date: Tue, 10 May 2005 14:47:58 +0000 (+0000) Subject: As we have the length of the string easily to hand, no reason not to X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea6e9374082ba65411b39d56a62387c8a2bd2879;p=p5sagit%2Fp5-mst-13.2.git As we have the length of the string easily to hand, no reason not to use it. p4raw-id: //depot/perl@24438 --- diff --git a/op.c b/op.c index 446bb59..e852f47 100644 --- a/op.c +++ b/op.c @@ -4234,6 +4234,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) const char *aname; GV *gv; char *ps; + STRLEN ps_len; register CV *cv=0; SV *const_sv; @@ -4241,7 +4242,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) if (proto) { assert(proto->op_type == OP_CONST); - ps = SvPVx(((SVOP*)proto)->op_sv, n_a); + ps = SvPVx(((SVOP*)proto)->op_sv, ps_len); } else ps = Nullch; @@ -4281,7 +4282,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) cv_ckproto((CV*)gv, NULL, ps); } if (ps) - sv_setpv((SV*)gv, ps); + sv_setpvn((SV*)gv, ps, ps_len); else sv_setiv((SV*)gv, -1); SvREFCNT_dec(PL_compcv); @@ -4434,7 +4435,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) CvSTASH(cv) = PL_curstash; if (ps) - sv_setpv((SV*)cv, ps); + sv_setpvn((SV*)cv, ps, ps_len); if (PL_error_count) { op_free(block);