typo on h2xs.PL (from Helmut Jarausch)
[p5sagit/p5-mst-13.2.git] / hv.h
diff --git a/hv.h b/hv.h
index 1763a88..11a602c 100644 (file)
--- 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