This is a followup to r2263. Use offsetof.
git-svn-id: svn://svn.valgrind.org/vex/trunk@2264 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/pub/libvex.h b/pub/libvex.h
index 5598fcc..a259fcc 100644
--- a/pub/libvex.h
+++ b/pub/libvex.h
@@ -345,7 +345,7 @@
static inline void* LibVEX_Alloc ( Int nbytes )
{
- struct {
+ struct align {
char c;
union {
char c;
@@ -361,7 +361,7 @@
void *pto;
void (*ptf)(void);
} x;
- } s;
+ };
#if 0
/* Nasty debugging hack, do not use. */
@@ -370,7 +370,7 @@
HChar* curr;
HChar* next;
Int ALIGN;
- ALIGN = ((Int) ((UChar *)&s.x - (UChar *)&s)) - 1;
+ ALIGN = offsetof(struct align,x) - 1;
nbytes = (nbytes + ALIGN) & ~ALIGN;
curr = private_LibVEX_alloc_curr;
next = curr + nbytes;