|
From: <sv...@va...> - 2012-02-27 15:43:07
|
Author: florian
Date: 2012-02-27 15:38:34 +0000 (Mon, 27 Feb 2012)
New Revision: 2264
Log:
This is a followup to r2263. Use offsetof.
Modified:
trunk/pub/libvex.h
Modified: trunk/pub/libvex.h
===================================================================
--- trunk/pub/libvex.h 2012-02-26 17:00:03 UTC (rev 2263)
+++ trunk/pub/libvex.h 2012-02-27 15:38:34 UTC (rev 2264)
@@ -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;
|