summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-01 15:08:02 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-01 15:08:02 +0000
commitd58e666644fd0ebaa0d73f9757e1090cc220dbb8 (patch)
treeb7d3daa5075559f0bc417296b7997244df77650e /hv.c
parentb79f7545f218479c6361e25f42849d88b9cef87e (diff)
downloadperl-d58e666644fd0ebaa0d73f9757e1090cc220dbb8.tar.gz
As PERL_HV_ARRAY_ALLOC_BYTES is bytes, not items, the type should be
char rather than HE *. Bug was harmless, overallocating by a factor of sizeof(HE *) p4raw-id: //depot/perl@24661
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hv.c b/hv.c
index cfb3812ae3..7df39770b2 100644
--- a/hv.c
+++ b/hv.c
@@ -603,10 +603,13 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
#ifdef DYNAMIC_ENV_FETCH /* if it's an %ENV lookup, we may get it on the fly */
|| (SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env))
#endif
- )
- Newz(503, HvARRAY(hv),
+ ) {
+ char *array;
+ Newz(503, array,
PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
- HE*);
+ char);
+ HvARRAY(hv) = (HE**)array;
+ }
#ifdef DYNAMIC_ENV_FETCH
else if (action & HV_FETCH_ISEXISTS) {
/* for an %ENV exists, if we do an insert it's by a recursive
@@ -773,9 +776,11 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
/* Not sure if we can get here. I think the only case of oentry being
NULL is for %ENV with dynamic env fetch. But that should disappear
with magic in the previous code. */
- Newz(503, HvARRAY(hv),
+ char *array;
+ Newz(503, array,
PERL_HV_ARRAY_ALLOC_BYTES(xhv->xhv_max+1 /* HvMAX(hv)+1 */),
- HE*);
+ char);
+ HvARRAY(hv) = (HE**)array;
}
oentry = &(HvARRAY(hv))[hash & (I32) xhv->xhv_max];