summaryrefslogtreecommitdiff
path: root/include/objalloc.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-09-18 09:59:28 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-09-18 09:59:28 +0000
commiteb65603afef6174d25b7654828f71769d4beff9c (patch)
tree001ac4ca9e23a2257ac400044a2e78a78b34f3b9 /include/objalloc.h
parent439c22790eb92fc38c0c4e91bc343ef8d0e55427 (diff)
downloadgdb-eb65603afef6174d25b7654828f71769d4beff9c.tar.gz
* objalloc.h (OBJALLOC_ALIGN): Define using offsetof.
Diffstat (limited to 'include/objalloc.h')
-rw-r--r--include/objalloc.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/objalloc.h b/include/objalloc.h
index 0b451cdc295..c7106478dca 100644
--- a/include/objalloc.h
+++ b/include/objalloc.h
@@ -1,5 +1,5 @@
/* objalloc.h -- routines to allocate memory for objects
- Copyright 1997 Free Software Foundation, Inc.
+ Copyright 1997, 2001 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Solutions.
This program is free software; you can redistribute it and/or modify it
@@ -56,12 +56,11 @@ struct objalloc_align { char x; double d; };
#ifndef offsetof
#include <stddef.h>
#endif
-#define OBJALLOC_ALIGN \
- ((ptrdiff_t) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0))
-#else
-#define OBJALLOC_ALIGN \
- ((long) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0))
#endif
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+#endif
+#define OBJALLOC_ALIGN offsetof (struct objalloc_align, d)
/* Create an objalloc structure. Returns NULL if malloc fails. */