From: Nicholas Clark Date: Mon, 5 Mar 2007 23:52:09 +0000 (+0000) Subject: As SvUPGRADE() is a macro wrapping a call to sv_upgrade() inside X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a7f3e459f22e8eecb8e377ed2a7b207cba1585f;p=p5sagit%2Fp5-mst-13.2.git As SvUPGRADE() is a macro wrapping a call to sv_upgrade() inside a check on the existing SvTYPE(), there's no need to wrap it inside another explcit check of SvTYPE(). This won't make any difference to the output of an optimising compiler, but it makes the source clearer. p4raw-id: //depot/perl@30481 --- diff --git a/pp_ctl.c b/pp_ctl.c index c9a7f58..f818869 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -291,8 +291,7 @@ PP(pp_substcont) SV * const sv = cx->sb_targ; MAGIC *mg; I32 i; - if (SvTYPE(sv) < SVt_PVMG) - SvUPGRADE(sv, SVt_PVMG); + SvUPGRADE(sv, SVt_PVMG); if (!(mg = mg_find(sv, PERL_MAGIC_regex_global))) { #ifdef PERL_OLD_COPY_ON_WRITE if (SvIsCOW(sv)) diff --git a/sv.c b/sv.c index ff2c9bf..3d5a4f3 100644 --- a/sv.c +++ b/sv.c @@ -4349,9 +4349,7 @@ Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, const MGVTBL *vtable, dVAR; MAGIC* mg; - if (SvTYPE(sv) < SVt_PVMG) { - SvUPGRADE(sv, SVt_PVMG); - } + SvUPGRADE(sv, SVt_PVMG); Newxz(mg, 1, MAGIC); mg->mg_moremagic = SvMAGIC(sv); SvMAGIC_set(sv, mg);