Merge the PVAV and PVHV clauses into the common code of S_pvgv_assign.
Nicholas Clark [Sun, 5 Feb 2006 23:20:21 +0000 (23:20 +0000)]
p4raw-id: //depot/perl@27100

sv.c

diff --git a/sv.c b/sv.c
index bf45564..233265c 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3090,30 +3090,6 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) {
     }
     GvMULTI_on(dstr);
     switch (SvTYPE(sref)) {
-    case SVt_PVAV:
-       if (intro)
-           SAVEGENERICSV(GvAV(dstr));
-       else
-           dref = (SV*)GvAV(dstr);
-       GvAV(dstr) = (AV*)sref;
-       if (!GvIMPORTED_AV(dstr)
-           && CopSTASH_ne(PL_curcop, GvSTASH(dstr)))
-           {
-               GvIMPORTED_AV_on(dstr);
-           }
-       break;
-    case SVt_PVHV:
-       if (intro)
-           SAVEGENERICSV(GvHV(dstr));
-       else
-           dref = (SV*)GvHV(dstr);
-       GvHV(dstr) = (HV*)sref;
-       if (!GvIMPORTED_HV(dstr)
-           && CopSTASH_ne(PL_curcop, GvSTASH(dstr)))
-           {
-               GvIMPORTED_HV_on(dstr);
-           }
-       break;
     case SVt_PVCV:
        if (intro) {
            if (GvCVGEN(dstr) && GvCV(dstr) != (CV*)sref) {
@@ -3169,6 +3145,14 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) {
            GvIMPORTED_CV_on(dstr);
        }
        break;
+    case SVt_PVHV:
+       location = (SV **) &GvHV(dstr);
+       import_flag = GVf_IMPORTED_HV;
+       goto common;
+    case SVt_PVAV:
+       location = (SV **) &GvAV(dstr);
+       import_flag = GVf_IMPORTED_AV;
+       goto common;
     case SVt_PVIO:
        location = (SV **) &GvIOp(dstr);
        goto common;