From: Stephen McCamant Date: Sun, 5 Jul 1998 17:36:14 +0000 (-0500) Subject: patch to remove assumptions about offset of IV being == sizeof(XPV) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=23e6a22f279db8eefd01132a30fcc45ff786ef2a;p=p5sagit%2Fp5-mst-13.2.git patch to remove assumptions about offset of IV being == sizeof(XPV) Message-ID: <13727.63831.95324.696098@alias-2.pr.mcs.net> Subject: [PATCH] alignment in X[IN]V allocation p4raw-id: //depot/perl@1329 --- diff --git a/sv.c b/sv.c index 6e137a3..7f1350b 100644 --- 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; }