* objalloc.h (OBJALLOC_ALIGN): Define using offsetof.
From-SVN: r45677
This commit is contained in:
parent
d71ebc326b
commit
b9bc4bf6de
2 changed files with 9 additions and 6 deletions
|
@ -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>
|
2001-09-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||||
|
|
||||||
* libiberty.h (concat_length, concat_copy, concat_copy2,
|
* libiberty.h (concat_length, concat_copy, concat_copy2,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* objalloc.h -- routines to allocate memory for objects
|
/* 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.
|
Written by Ian Lance Taylor, Cygnus Solutions.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
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
|
#ifndef offsetof
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#endif
|
#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
|
#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. */
|
/* Create an objalloc structure. Returns NULL if malloc fails. */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue