diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-06-19 22:28:00 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-06-19 22:28:00 +0200 |
commit | a5bc733f1c7462c550f55a2c1b2fbf1e6a708100 (patch) | |
tree | 9b0fa7e885ff3c736da44235713e0946cc58d641 /stack-alloc.c | |
parent | d3e7518f1aa6315a2e4d4bbb669f04dd71744717 (diff) | |
download | gmp-a5bc733f1c7462c550f55a2c1b2fbf1e6a708100.tar.gz |
* stack-alloc.c (tmp_stack): Move private parts of stack-alloc.h to
here, use gmp-impl.h.
Diffstat (limited to 'stack-alloc.c')
-rw-r--r-- | stack-alloc.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/stack-alloc.c b/stack-alloc.c index 7e767f42c..fa1ccce88 100644 --- a/stack-alloc.c +++ b/stack-alloc.c @@ -20,24 +20,19 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "stack-alloc.h" - -#define __need_size_t -#include <stddef.h> -#undef __need_size_t - -/* gmp-impl.h and stack-alloc.h conflict when not USE_STACK_ALLOC, so these - declarations are copied here */ -#if __STDC__ -extern void * (*__gmp_allocate_func) (size_t); -extern void (*__gmp_free_func) (void *, size_t); -#else -extern void * (*__gmp_allocate_func) (); -extern void (*__gmp_free_func) (); -#endif +#include "gmp.h" +#include "gmp-impl.h" + +struct tmp_stack +{ + void *end; + void *alloc_point; + struct tmp_stack *prev; +}; typedef struct tmp_stack tmp_stack; + static unsigned long max_total_allocation = 0; static unsigned long current_total_allocation = 0; @@ -45,7 +40,8 @@ static tmp_stack xxx = {&xxx, &xxx, 0}; static tmp_stack *current = &xxx; /* The rounded size of the header of each allocation block. */ -#define HSIZ ((sizeof (tmp_stack) + __TMP_ALIGN - 1) & -__TMP_ALIGN) +#define HSIZ ROUND_UP_MULTIPLE (sizeof (tmp_stack), __TMP_ALIGN) + /* Allocate a block of exactly <size> bytes. This should only be called through the TMP_ALLOC macro, which takes care of rounding/alignment. */ |