Start to merge the 6 arms of S_pvgv_assign into one.
Nicholas Clark [Sun, 5 Feb 2006 22:41:42 +0000 (22:41 +0000)]
p4raw-id: //depot/perl@27098

sv.c

diff --git a/sv.c b/sv.c
index 8b00fb5..243c8c2 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3074,6 +3074,7 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) {
     SV * const sref = SvREFCNT_inc(SvRV(sstr));
     SV *dref = NULL;
     const int intro = GvINTRO(dstr);
+    SV **location;
 
 #ifdef GV_UNIQUE_CHECK
     if (GvUNIQUE((GV*)dstr)) {
@@ -3168,18 +3169,16 @@ S_pvgv_assign(pTHX_ SV *dstr, SV *sstr) {
        }
        break;
     case SVt_PVIO:
-       if (intro)
-           SAVEGENERICSV(GvIOp(dstr));
-       else
-           dref = (SV*)GvIOp(dstr);
-       GvIOp(dstr) = (IO*)sref;
-       break;
+       location = (SV **) &GvIOp(dstr);
+       goto common;
     case SVt_PVFM:
+       location = (SV **) &GvFORM(dstr);
+    common:
        if (intro)
-           SAVEGENERICSV(GvFORM(dstr));
+           SAVEGENERICSV(*location);
        else
-           dref = (SV*)GvFORM(dstr);
-       GvFORM(dstr) = (CV*)sref;
+           dref = *location;
+       *location = sref;
        break;
     default:
        if (intro)