summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-07-17 16:17:58 +0100
committerNicholas Clark <nick@ccl4.org>2009-07-17 17:39:46 +0100
commitb6f609162799aa49813b53c8242464db37fcee9b (patch)
treeff78dab5934ab802fe26af0ee59e0fe5b859dc76 /sv.c
parentc533d96e5f6c9e94d3d34f6ff54accc877705220 (diff)
downloadperl-b6f609162799aa49813b53c8242464db37fcee9b.tar.gz
Eliminate struct regexp_allocated and xpvio_allocated.
Calculate memory allocation using regexp and XPVIO, and the offset of the first real structure member. This avoids tripping over alignment differences between X* and x*_allocated, because x*_allocated doesn't have a double in it.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sv.c b/sv.c
index 4699a4e283..76fd6e443a 100644
--- a/sv.c
+++ b/sv.c
@@ -975,10 +975,11 @@ static const struct body_details bodies_by_type[] = {
HASARENA, FIT_ARENA(0, sizeof(XPVMG)) },
/* something big */
- { sizeof(struct regexp_allocated), sizeof(struct regexp_allocated),
- + relative_STRUCT_OFFSET(struct regexp_allocated, regexp, xpv_cur),
+ { sizeof(regexp) - STRUCT_OFFSET(regexp, xpv_cur),
+ sizeof(regexp) - STRUCT_OFFSET(regexp, xpv_cur),
+ + STRUCT_OFFSET(regexp, xpv_cur),
SVt_REGEXP, FALSE, NONV, HASARENA,
- FIT_ARENA(0, sizeof(struct regexp_allocated))
+ FIT_ARENA(0, sizeof(regexp) - STRUCT_OFFSET(regexp, xpv_cur))
},
/* 48 */
@@ -1011,9 +1012,11 @@ static const struct body_details bodies_by_type[] = {
SVt_PVFM, TRUE, NONV, NOARENA, FIT_ARENA(20, sizeof(xpvfm_allocated)) },
/* XPVIO is 84 bytes, fits 48x */
- { sizeof(xpvio_allocated), sizeof(xpvio_allocated),
- + relative_STRUCT_OFFSET(xpvio_allocated, XPVIO, xpv_cur),
- SVt_PVIO, TRUE, NONV, HASARENA, FIT_ARENA(24, sizeof(xpvio_allocated)) },
+ { sizeof(XPVIO) - STRUCT_OFFSET(XPVIO, xpv_cur),
+ sizeof(XPVIO) - STRUCT_OFFSET(XPVIO, xpv_cur),
+ + STRUCT_OFFSET(XPVIO, xpv_cur),
+ SVt_PVIO, TRUE, NONV, HASARENA,
+ FIT_ARENA(24, sizeof(XPVIO) - STRUCT_OFFSET(XPVIO, xpv_cur)) },
};
#define new_body_type(sv_type) \