summaryrefslogtreecommitdiff
path: root/lib/obstack.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-10-29 14:02:31 +1030
committerPaul Eggert <eggert@cs.ucla.edu>2014-10-29 00:23:38 -0700
commit266ac1b98dbf76a78cdc584b10ed73355a084e7a (patch)
treed05f59d8885af49e3e8d336c4321c0b4ac233c6d /lib/obstack.h
parent8216dffc279801576da195c4a259f4ed2f00b230 (diff)
downloadgnulib-266ac1b98dbf76a78cdc584b10ed73355a084e7a.tar.gz
obstack: 64-bit obstack support, part 1
a) Correct calls to alloc function, to use a size_t arg. "long" is just wrong on targets like x86_64-mingw64 where "long" is 32 bits and "size_t" 64 bits. b) Consolidate _obstack_begin and _obstack_begin1 code. * lib/obstack.h (struct obstack <chunkfun>): Correct prototype to use "size_t" rather than "long". (_obstack_begin, _obstack_begin1): Likewise. (obstack_init, obstack_begin, obstack_specify_allocation_with_arg, obstack_chunkfun): Update alloc function casts. * lib/obstack.c (CALL_CHUNKFUN): Update chunkfun cast. (chunkfun_type, freefun_type): New typdefs. (_obstack_begin_worker): Split out from .. (_obstack_begin, _obstack_begin_1): ..here.
Diffstat (limited to 'lib/obstack.h')
-rw-r--r--lib/obstack.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/obstack.h b/lib/obstack.h
index f3a7c77f07..ef647aa404 100644
--- a/lib/obstack.h
+++ b/lib/obstack.h
@@ -156,7 +156,7 @@ struct obstack /* control current object in current chunk */
/* These prototypes vary based on 'use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
- struct _obstack_chunk *(*chunkfun) (void *, long);
+ struct _obstack_chunk *(*chunkfun) (void *, size_t);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
unsigned use_extra_arg : 1; /* chunk alloc/dealloc funcs take extra arg */
@@ -174,9 +174,9 @@ struct obstack /* control current object in current chunk */
extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int,
- void *(*)(long), void (*)(void *));
+ void *(*)(size_t), void (*)(void *));
extern int _obstack_begin_1 (struct obstack *, int, int,
- void *(*)(void *, long),
+ void *(*)(void *, size_t),
void (*)(void *, void *), void *);
extern int _obstack_memory_used (struct obstack *) __attribute_pure__;
@@ -211,26 +211,26 @@ extern int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list. */
#define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
- (void *(*)(long))obstack_chunk_alloc, \
+ (void *(*)(size_t))obstack_chunk_alloc, \
(void (*)(void *))obstack_chunk_free)
#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
- (void *(*)(long))obstack_chunk_alloc, \
+ (void *(*)(size_t))obstack_chunk_alloc, \
(void (*)(void *))obstack_chunk_free)
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
- (void *(*)(long))(chunkfun), \
+ (void *(*)(size_t))(chunkfun), \
(void (*)(void *))(freefun))
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
- (void *(*)(void *, long))(chunkfun), \
+ (void *(*)(void *, size_t))(chunkfun), \
(void (*)(void *, void *))(freefun), (arg))
#define obstack_chunkfun(h, newchunkfun) \
- ((h)->chunkfun = (struct _obstack_chunk *(*)(void *, long))(newchunkfun))
+ ((h)->chunkfun = (struct _obstack_chunk *(*)(void *, size_t))(newchunkfun))
#define obstack_freefun(h, newfreefun) \
((h)->freefun = (void (*)(void *, struct _obstack_chunk *))(newfreefun))