X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.c;h=4831ccd563ad38db1cc0b76ce23ab5d645768f83;hb=83f957ec18f48986bbac4f0b35e66bbc0e02ccdf;hp=bc1e305fdf288d678ac72d48e9ae5257a757648e;hpb=fd7de8a8466b26f91b016c44f0d429fd3725d9d0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.c b/hv.c index bc1e305..4831ccd 100644 --- a/hv.c +++ b/hv.c @@ -43,7 +43,7 @@ S_more_he(pTHX) HE* he; HE* heend; - he = (HE*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE); + he = (HE*) Perl_get_arena(aTHX_ PERL_ARENA_SIZE, HE_SVSLOT); heend = &he[PERL_ARENA_SIZE / sizeof(HE) - 1]; PL_body_roots[HE_SVSLOT] = he; @@ -68,23 +68,19 @@ S_new_he(pTHX) HE* he; void ** const root = &PL_body_roots[HE_SVSLOT]; - LOCK_SV_MUTEX; if (!*root) S_more_he(aTHX); he = (HE*) *root; assert(he); *root = HeNEXT(he); - UNLOCK_SV_MUTEX; return he; } #define new_HE() new_he() #define del_HE(p) \ STMT_START { \ - LOCK_SV_MUTEX; \ HeNEXT(p) = (HE*)(PL_body_roots[HE_SVSLOT]); \ PL_body_roots[HE_SVSLOT] = p; \ - UNLOCK_SV_MUTEX; \ } STMT_END @@ -1401,12 +1397,9 @@ HV * Perl_newHV(pTHX) { register XPVHV* xhv; - HV * const hv = (HV*)newSV(0); - - sv_upgrade((SV *)hv, SVt_PVHV); + HV * const hv = (HV*)newSV_type(SVt_PVHV); xhv = (XPVHV*)SvANY(hv); - SvPOK_off(hv); - SvNOK_off(hv); + assert(!SvOK(hv)); #ifndef NODEFAULT_SHAREKEYS HvSHAREKEYS_on(hv); /* key-sharing on by default */ #endif @@ -2296,6 +2289,7 @@ Perl_unsharepvn(pTHX_ const char *str, I32 len, U32 hash) void Perl_unshare_hek(pTHX_ HEK *hek) { + assert(hek); unshare_hek_or_pvn(hek, NULL, 0, 0); } @@ -2594,8 +2588,7 @@ S_refcounted_he_value(pTHX_ const struct refcounted_he *he) case HVrhek_PV: /* Create a string SV that directly points to the bytes in our structure. */ - value = newSV(0); - sv_upgrade(value, SVt_PV); + value = newSV_type(SVt_PV); SvPV_set(value, (char *) he->refcounted_he_data + 1); SvCUR_set(value, he->refcounted_he_val.refcounted_he_u_len); /* This stops anything trying to free it */ @@ -2623,7 +2616,7 @@ S_refcounted_he_value(pTHX_ const struct refcounted_he *he) /* =for apidoc refcounted_he_chain_2hv -Generates an returns a C by walking up the tree starting at the passed +Generates and returns a C by walking up the tree starting at the passed in C. =cut