From: Nicholas Clark Date: Thu, 2 Jun 2005 13:36:01 +0000 (+0000) Subject: Changes 24660 and 24665 both introduced errors into the USEMYMALLOC X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a9b70e91d2c0aa19f8cec5b0f8c133492a19280;p=p5sagit%2Fp5-mst-13.2.git Changes 24660 and 24665 both introduced errors into the USEMYMALLOC code. Plus change 24672 appears to break under USEMYMALLOC, so revert it for now. p4raw-id: //depot/perl@24676 --- diff --git a/hv.c b/hv.c index 7df3977..5f0f485 100644 --- a/hv.c +++ b/hv.c @@ -1126,7 +1126,7 @@ S_hsplit(pTHX_ HV *hv) return; } if (SvOOK(hv)) { - Copy(HvAUX(hv), &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); + Copy(&a[oldsize * sizeof(HE*)], &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); } #else New(2, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize) @@ -1296,7 +1296,7 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax) return; } if (SvOOK(hv)) { - Copy(HvAUX(hv), &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); + Copy(&a[oldsize * sizeof(HE*)], &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); } #else New(2, a, PERL_HV_ARRAY_ALLOC_BYTES(newsize) diff --git a/sv.c b/sv.c index 9a61a35..e71ac3a 100644 --- a/sv.c +++ b/sv.c @@ -2040,8 +2040,8 @@ Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen) s = SvPVX(sv); if (newlen > SvLEN(sv)) { /* need more room? */ + newlen = PERL_STRLEN_ROUNDUP(newlen); if (SvLEN(sv) && s) { - newlen = PERL_STRLEN_ROUNDUP(newlen); #ifdef MYMALLOC const STRLEN l = malloced_size((void*)SvPVX(sv)); if (newlen <= l) { @@ -2052,7 +2052,6 @@ Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen) s = saferealloc(s, newlen); } else { - newlen = PERL_STRLEN_ROUNDUP(newlen); s = safemalloc(newlen); if (SvPVX(sv) && SvCUR(sv)) { Move(SvPVX(sv), s, (newlen < SvCUR(sv)) ? newlen : SvCUR(sv), char); @@ -4825,7 +4824,7 @@ Perl_sv_usepvn(pTHX_ register SV *sv, register char *ptr, register STRLEN len) SvPV_free(sv); allocate = PERL_STRLEN_ROUNDUP(len + 1); - ptr = safesysrealloc (ptr, allocate); + ptr = saferealloc (ptr, allocate); SvPV_set(sv, ptr); SvCUR_set(sv, len); SvLEN_set(sv, allocate); diff --git a/toke.c b/toke.c index 8c13ba2..cb17be9 100644 --- a/toke.c +++ b/toke.c @@ -5538,9 +5538,8 @@ S_pending_ident(pTHX) /* might be an "our" variable" */ if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) { /* build ops for a bareword */ - HV *stash = PAD_COMPNAME_OURSTASH(tmp); - HEK *stashname = HvNAME_HEK(stash); - SV *sym = newSVpvn(HEK_KEY(stashname), HEK_LEN(stashname)); + SV *sym = newSVpvn(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)), + HvNAMELEN_get(PAD_COMPNAME_OURSTASH(tmp))); sv_catpvn(sym, "::", 2); sv_catpv(sym, PL_tokenbuf+1); yylval.opval = (OP*)newSVOP(OP_CONST, 0, sym); @@ -9740,10 +9739,9 @@ S_scan_inputsymbol(pTHX_ char *start) */ if ((tmp = pad_findmy(d)) != NOT_IN_PAD) { if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) { - HV *stash = PAD_COMPNAME_OURSTASH(tmp); - HEK *stashname = HvNAME_HEK(stash); - SV *sym = sv_2mortal(newSVpvn(HEK_KEY(stashname), - HEK_LEN(stashname))); + SV *sym = sv_2mortal( + newSVpvn(HvNAME_get(PAD_COMPNAME_OURSTASH(tmp)), + HvNAMELEN_get(PAD_COMPNAME_OURSTASH(tmp)))); sv_catpvn(sym, "::", 2); sv_catpv(sym, d+1); d = SvPVX(sym);