From: Nicholas Clark Date: Sun, 5 Feb 2006 23:02:58 +0000 (+0000) Subject: Merge the default case (GvSV) with the common code in S_pvgv_assign. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3386d0834ef0b63f4c990258eeb15753779daf16;p=p5sagit%2Fp5-mst-13.2.git Merge the default case (GvSV) with the common code in S_pvgv_assign. p4raw-id: //depot/perl@27099 --- diff --git a/sv.c b/sv.c index 243c8c2..bf45564 100644 --- a/sv.c +++ b/sv.c @@ -3075,6 +3075,7 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) { SV *dref = NULL; const int intro = GvINTRO(dstr); SV **location; + U8 import_flag = 0; #ifdef GV_UNIQUE_CHECK if (GvUNIQUE((GV*)dstr)) { @@ -3173,21 +3174,18 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) { goto common; case SVt_PVFM: location = (SV **) &GvFORM(dstr); + default: + location = &GvSV(dstr); + import_flag = GVf_IMPORTED_SV; common: if (intro) SAVEGENERICSV(*location); else dref = *location; *location = sref; - break; - default: - if (intro) - SAVEGENERICSV(GvSV(dstr)); - else - dref = (SV*)GvSV(dstr); - GvSV(dstr) = sref; - if (!GvIMPORTED_SV(dstr) && CopSTASH_ne(PL_curcop, GvSTASH(dstr))) { - GvIMPORTED_SV_on(dstr); + if (import_flag && !(GvFLAGS(dstr) & import_flag) + && CopSTASH_ne(PL_curcop, GvSTASH(dstr))) { + GvFLAGS(dstr) |= import_flag; } break; }