This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: filename problems
[perl5.git] / hv.c
diff --git a/hv.c b/hv.c
index 2962de3..d553920 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1191,7 +1191,9 @@ Perl_newHVhv(pTHX_ HV *ohv)
        /* It's an ordinary hash, so copy it fast. AMS 20010804 */
        int i, shared = !!HvSHAREKEYS(ohv);
        HE **ents, **oents = (HE **)HvARRAY(ohv);
-       New(0, (char *)ents, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char);
+       char *a;
+       New(0, a, PERL_HV_ARRAY_ALLOC_BYTES(hv_max+1), char);
+       ents = (HE**)a;
 
        /* In each bucket... */
        for (i = 0; i <= hv_max; i++) {
@@ -1209,7 +1211,7 @@ Perl_newHVhv(pTHX_ HV *ohv)
                STRLEN len = HeKLEN_UTF8(oent);
 
                ent = new_HE();
-               HeVAL(ent)     = SvREFCNT_inc(HeVAL(oent));
+               HeVAL(ent)     = newSVsv(HeVAL(oent));
                HeKEY_hek(ent) = shared ? share_hek(key, len, hash)
                                        :  save_hek(key, len, hash);
                if (prev)