aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-09-18 13:39:40 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-09-18 13:39:40 +0000
commit78367e01090edc0467d434db783ea4db96462513 (patch)
tree76b22daab5767c28829e58824fe43224587f6130 /include
parent86130d5b2bc1da7edd6f20d64ad206e88d7540ce (diff)
* objalloc.h (OBJALLOC_ALIGN): Define using offsetof.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@45677 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog4
-rw-r--r--include/objalloc.h11
2 files changed, 9 insertions, 6 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index a20b8b82e5c..2a69d82cd68 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2001-09-18 Alan Modra <amodra@bigpond.net.au>
+
+ * objalloc.h (OBJALLOC_ALIGN): Define using offsetof.
+
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (concat_length, concat_copy, concat_copy2,
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. */