X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.h;h=11a602c1b75e8efb12e06c686d6d0b10307e42e5;hb=65346fe1a9b07a3de1b94fead7e905d3a8dad1d5;hp=1763a8860f478eb07bf1f2e002314cbf1e9a00a9;hpb=08105a92a3e1f0f7ac18e8807e8c0cad635b748a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.h b/hv.h index 1763a88..11a602c 100644 --- a/hv.h +++ b/hv.h @@ -1,6 +1,6 @@ /* hv.h * - * Copyright (c) 1991-1997, Larry Wall + * Copyright (c) 1991-1999, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -28,7 +28,7 @@ struct xpvhv { STRLEN xhv_fill; /* how full xhv_array currently is */ STRLEN xhv_max; /* subscript of last element of xhv_array */ IV xhv_keys; /* how many elements in the array */ - double xnv_nv; /* numeric value, if any */ + NV xnv_nv; /* numeric value, if any */ MAGIC* xmg_magic; /* magic for scalar array */ HV* xmg_stash; /* class package */ @@ -104,7 +104,7 @@ struct xpvhv { #define HeSVKEY_force(he) (HeKEY(he) ? \ ((HeKLEN(he) == HEf_SVKEY) ? \ HeKEY_sv(he) : \ - sv_2mortal(newSVpv(HeKEY(he), \ + sv_2mortal(newSVpvn(HeKEY(he), \ HeKLEN(he)))) : \ &PL_sv_undef) #define HeSVKEY_set(he,sv) ((HeKLEN(he) = HEf_SVKEY), (HeKEY_sv(he) = sv)) @@ -114,3 +114,13 @@ struct xpvhv { #define HEK_HASH(hek) (hek)->hek_hash #define HEK_LEN(hek) (hek)->hek_len #define HEK_KEY(hek) (hek)->hek_key + +#if defined(STRANGE_MALLOC) || defined(MYMALLOC) +# define PERL_HV_ARRAY_ALLOC_BYTES(size) ((size) * sizeof(HE*)) +#else +# define MALLOC_OVERHEAD 16 +# define PERL_HV_ARRAY_ALLOC_BYTES(size) \ + (((size) < 64) \ + ? (size) * sizeof(HE*) \ + : (size) * sizeof(HE*) * 2 - MALLOC_OVERHEAD) +#endif