From: Nicholas Clark Date: Thu, 18 Oct 2007 16:15:22 +0000 (+0000) Subject: In Perl_amagic_call(), construct the SV with newSVpvn(), as we now know X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82af65938b18604bedb1e907fce033a213303aaf;p=p5sagit%2Fp5-mst-13.2.git In Perl_amagic_call(), construct the SV with newSVpvn(), as we now know the length. (Not sure why I didn't spot this one during change 32124.) p4raw-id: //depot/perl@32132 --- diff --git a/gv.c b/gv.c index a9eb65a..d34d043 100644 --- a/gv.c +++ b/gv.c @@ -2037,7 +2037,8 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) PUSHs(lr>0? left: right); PUSHs( lr > 0 ? &PL_sv_yes : ( assign ? &PL_sv_undef : &PL_sv_no )); if (notfound) { - PUSHs( sv_2mortal(newSVpv(AMG_id2name(method + assignshift),0))); + PUSHs( sv_2mortal(newSVpvn(AMG_id2name(method + assignshift), + AMG_id2namelen(method + assignshift)))); } PUSHs((SV*)cv); PUTBACK; diff --git a/overload.c b/overload.c index bb7f1cb..eaaef21 100644 --- a/overload.c +++ b/overload.c @@ -13,6 +13,7 @@ */ #define AMG_id2name(id) (PL_AMG_names[id]+1) +#define AMG_id2namelen(id) (PL_AMG_namelens[id]-1) const U8 PL_AMG_namelens[NofAMmeth] = { 2, diff --git a/overload.pl b/overload.pl index 6b1050e..a86222e 100644 --- a/overload.pl +++ b/overload.pl @@ -70,6 +70,7 @@ EOF print C <<'EOF'; #define AMG_id2name(id) (PL_AMG_names[id]+1) +#define AMG_id2namelen(id) (PL_AMG_namelens[id]-1) const U8 PL_AMG_namelens[NofAMmeth] = { EOF