diff options
author | Kevin Ryde <user42@zip.com.au> | 2000-04-29 00:41:32 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2000-04-29 00:41:32 +0200 |
commit | bfb5950de7c599f60298762d62329ed66ac5c316 (patch) | |
tree | 5a8dc2a409e9a38aad04865e70067c01f1a8b5dd /stack-alloc.c | |
parent | eb36ff0e223a21a4d4f0503b9f1135a1e81a1a5f (diff) | |
download | gmp-bfb5950de7c599f60298762d62329ed66ac5c316.tar.gz |
* stack-alloc.c: Dual ANSI/K&R support, add a type cast in one place,
don't use C++ reserved word "this".
Diffstat (limited to 'stack-alloc.c')
-rw-r--r-- | stack-alloc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/stack-alloc.c b/stack-alloc.c index c4336683e..048cd8db1 100644 --- a/stack-alloc.c +++ b/stack-alloc.c @@ -50,10 +50,14 @@ static tmp_stack *current = &xxx; /* Allocate a block of exactly <size> bytes. This should only be called through the TMP_ALLOC macro, which takes care of rounding/alignment. */ void * +#if __STDC__ +__gmp_tmp_alloc (unsigned long size) +#else __gmp_tmp_alloc (size) unsigned long size; +#endif { - void *this; + void *that; if (size > (char *) current->end - (char *) current->alloc_point) { @@ -83,24 +87,28 @@ __gmp_tmp_alloc (size) } chunk = (*__gmp_allocate_func) (chunk_size); - header = chunk; + header = (tmp_stack *) chunk; header->end = (char *) chunk + chunk_size; header->alloc_point = (char *) chunk + HSIZ; header->prev = current; current = header; } - this = current->alloc_point; - current->alloc_point = (char *) this + size; - return this; + that = current->alloc_point; + current->alloc_point = (char *) that + size; + return that; } /* Typically called at function entry. <mark> is assigned so that __gmp_tmp_free can later be used to reclaim all subsequently allocated storage. */ void +#if __STDC__ +__gmp_tmp_mark (tmp_marker *mark) +#else __gmp_tmp_mark (mark) tmp_marker *mark; +#endif { mark->which_chunk = current; mark->alloc_point = current->alloc_point; @@ -108,8 +116,12 @@ __gmp_tmp_mark (mark) /* Free everything allocated since <mark> was assigned by __gmp_tmp_mark */ void +#if __STDC__ +__gmp_tmp_free (tmp_marker *mark) +#else __gmp_tmp_free (mark) tmp_marker *mark; +#endif { while (mark->which_chunk != current) { |