patch to remove assumptions about offset of IV being == sizeof(XPV)
authorStephen McCamant <smcc@mit.edu>
Sun, 5 Jul 1998 17:36:14 +0000 (12:36 -0500)
committerGurusamy Sarathy <gsar@cpan.org>
Sun, 5 Jul 1998 23:05:40 +0000 (23:05 +0000)
Message-ID: <13727.63831.95324.696098@alias-2.pr.mcs.net>
Subject: [PATCH] alignment in X[IN]V allocation

p4raw-id: //depot/perl@1329

sv.c

diff --git a/sv.c b/sv.c
index 6e137a3..7f1350b 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -423,7 +423,7 @@ new_xiv(void)
         * See comment in more_xiv() -- RAM.
         */
        xiv_root = *(IV**)xiv;
-       return (XPVIV*)((char*)xiv - sizeof(XPV));
+       return (XPVIV*)((char*)xiv - STRUCT_OFFSET(XPVIV, xiv_iv));
     }
     return more_xiv();
 }
@@ -431,7 +431,7 @@ new_xiv(void)
 STATIC void
 del_xiv(XPVIV *p)
 {
-    IV* xiv = (IV*)((char*)(p) + sizeof(XPV));
+    IV* xiv = (IV*)((char*)(p) + STRUCT_OFFSET(XPVIV, xiv_iv));
     *(IV**)xiv = xiv_root;
     xiv_root = xiv;
 }
@@ -465,7 +465,7 @@ new_xnv(void)
     if (xnv_root) {
        xnv = xnv_root;
        xnv_root = *(double**)xnv;
-       return (XPVNV*)((char*)xnv - sizeof(XPVIV));
+       return (XPVNV*)((char*)xnv - STRUCT_OFFSET(XPVNV, xnv_nv));
     }
     return more_xnv();
 }
@@ -473,7 +473,7 @@ new_xnv(void)
 STATIC void
 del_xnv(XPVNV *p)
 {
-    double* xnv = (double*)((char*)(p) + sizeof(XPVIV));
+    double* xnv = (double*)((char*)(p) + STRUCT_OFFSET(XPVNV, xnv_nv));
     *(double**)xnv = xnv_root;
     xnv_root = xnv;
 }