objalloc.h (60484) | objalloc.h (89857) |
---|---|
1/* objalloc.h -- routines to allocate memory for objects | 1/* objalloc.h -- routines to allocate memory for objects |
2 Copyright 1997 Free Software Foundation, Inc. | 2 Copyright 1997, 2001 Free Software Foundation, Inc. |
3 Written by Ian Lance Taylor, Cygnus Solutions. 4 5This program is free software; you can redistribute it and/or modify it 6under the terms of the GNU General Public License as published by the 7Free Software Foundation; either version 2, or (at your option) any 8later version. 9 10This program is distributed in the hope that it will be useful, --- 40 unchanged lines hidden (view full) --- 51/* Work out the required alignment. */ 52 53struct objalloc_align { char x; double d; }; 54 55#if defined (__STDC__) && __STDC__ 56#ifndef offsetof 57#include <stddef.h> 58#endif | 3 Written by Ian Lance Taylor, Cygnus Solutions. 4 5This program is free software; you can redistribute it and/or modify it 6under the terms of the GNU General Public License as published by the 7Free Software Foundation; either version 2, or (at your option) any 8later version. 9 10This program is distributed in the hope that it will be useful, --- 40 unchanged lines hidden (view full) --- 51/* Work out the required alignment. */ 52 53struct objalloc_align { char x; double d; }; 54 55#if defined (__STDC__) && __STDC__ 56#ifndef offsetof 57#include <stddef.h> 58#endif |
59#define OBJALLOC_ALIGN \ 60 ((ptrdiff_t) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) 61#else 62#define OBJALLOC_ALIGN \ 63 ((long) ((char *) &((struct objalloc_align *) 0)->d - (char *) 0)) | |
64#endif | 59#endif |
60#ifndef offsetof 61#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) 62#endif 63#define OBJALLOC_ALIGN offsetof (struct objalloc_align, d) |
|
65 66/* Create an objalloc structure. Returns NULL if malloc fails. */ 67 68extern struct objalloc *objalloc_create PARAMS ((void)); 69 70/* Allocate space from an objalloc structure. Returns NULL if malloc 71 fails. */ 72 --- 44 unchanged lines hidden --- | 64 65/* Create an objalloc structure. Returns NULL if malloc fails. */ 66 67extern struct objalloc *objalloc_create PARAMS ((void)); 68 69/* Allocate space from an objalloc structure. Returns NULL if malloc 70 fails. */ 71 --- 44 unchanged lines hidden --- |