* objalloc.h (OBJALLOC_ALIGN): Define using offsetof.
authorAlan Modra <amodra@gmail.com>
Tue, 18 Sep 2001 09:59:28 +0000 (09:59 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 18 Sep 2001 09:59:28 +0000 (09:59 +0000)
include/ChangeLog
include/objalloc.h

index 6c25ae3fc927366f24273c7c3ec7fbb2af4c3637..f77ca19d104400a86adf87d7da81e9fc123ca0cd 100644 (file)
@@ -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,
index 0b451cdc2959efcacc703ba336ba18bc13b593a4..c7106478dca49064d8a0e96595a8b6cdb11524b9 100644 (file)
@@ -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.  */
 
This page took 0.027525 seconds and 4 git commands to generate.