This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document in one place the memory abstractions used in Perl core.
[perl5.git] / hv.c
diff --git a/hv.c b/hv.c
index fd2c2d7..6a07615 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -42,9 +42,14 @@ S_more_he(pTHX)
 {
     register HE* he;
     register HE* heend;
-    New(54, PL_he_root, 1008/sizeof(HE), HE);
-    he = PL_he_root;
+    XPV *ptr;
+    New(54, ptr, 1008/sizeof(XPV), XPV);
+    ptr->xpv_pv = (char*)PL_he_arenaroot;
+    PL_he_arenaroot = ptr;
+
+    he = (HE*)ptr;
     heend = &he[1008 / sizeof(HE) - 1];
+    PL_he_root = ++he;
     while (he < heend) {
         HeNEXT(he) = (HE*)(he + 1);
         he++;
@@ -1044,7 +1049,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
        
        /* Slow way */
        hv_iterinit(ohv);
-       while (entry = hv_iternext(ohv)) {
+       while ((entry = hv_iternext(ohv))) {
            hv_store(hv, HeKEY(entry), HeKLEN(entry), 
                     SvREFCNT_inc(HeVAL(entry)), HeHASH(entry));
        }
@@ -1238,7 +1243,7 @@ Perl_hv_iternext(pTHX_ HV *hv)
     xhv = (XPVHV*)SvANY(hv);
     oldentry = entry = xhv->xhv_eiter;
 
-    if (mg = SvTIED_mg((SV*)hv, 'P')) {
+    if ((mg = SvTIED_mg((SV*)hv, 'P'))) {
        SV *key = sv_newmortal();
        if (entry) {
            sv_setsv(key, HeSVKEY_force(entry));