iterator reset moved to hv.c (was: [PATCH] SCALAR/FIRSTKEY for tied hashes in scalar...
Tassilo von Parseval [Mon, 8 Dec 2003 08:17:46 +0000 (09:17 +0100)]
Message-id: <20031208071746.GA594@ethan>

p4raw-id: //depot/perl@21869

hv.c
mg.c

diff --git a/hv.c b/hv.c
index ec616c0..4f95d1e 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1452,7 +1452,7 @@ Perl_hv_clear(pTHX_ HV *hv)
                }
            }
        }
-       return;
+       goto reset;
     }
 
     hfreeentries(hv);
@@ -1466,6 +1466,8 @@ Perl_hv_clear(pTHX_ HV *hv)
 
     HvHASKFLAGS_off(hv);
     HvREHASH_off(hv);
+    reset:
+    HvEITER(hv) = NULL;
 }
 
 /*
diff --git a/mg.c b/mg.c
index 2529ff7..7955e52 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1539,11 +1539,6 @@ Perl_magic_wipepack(pTHX_ SV *sv, MAGIC *mg)
     POPSTACK;
     LEAVE;
 
-    if (SvTYPE(sv) == SVt_PVHV)
-        /* must reset iterator otherwise Perl_magic_scalarpack
-         * wont report a false value on a cleared hash */
-        HvEITER((HV*)sv) = NULL;
-    
     return 0;
 }