]> Savannah Git Hosting - gnulib.git/commit
obstack: 64-bit obstack support, part 2
authorAlan Modra <amodra@gmail.com>
Wed, 29 Oct 2014 03:32:40 +0000 (14:02 +1030)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 29 Oct 2014 07:23:38 +0000 (00:23 -0700)
commitbb2ab7ecb6c92895e69837414f238568f013a603
tree9d593ac2ce26db0ee0510d4d2a7fd9d257ab1a11
parent266ac1b98dbf76a78cdc584b10ed73355a084e7a
obstack: 64-bit obstack support, part 2

This gets us 4G obstack support, without changing ABI compatibility,
apart from possibly introducing some signed/unsigned comparison
warnings in code that uses obstack.h.

a) Replace "int" size parameters, return values, and macro local vars
   with _OBSTACK_SIZE_T, an "unsigned int" for now.
b) Make obstack.chunk_size a _CHUNK_SIZE_T, an "unsigned long" for now.
c) Make all obstack macros checking available room use obstack_room.
   "next_free + desired > chunk_limit" may wrap the lhs for chunks
   allocated near the top of memory.
d) Use unsigned comparisons, and macro locals to support >2G on 32-bit.

* lib/obstack.h (_OBSTACK_SIZE_T): Define.  Use throughout
in place of "int" size parameters, return values and local vars.
(_CHUNK_SIZE_T): Define.
(struct obstack): Make chunk_size a _CHUNK_SIZE_T.  Make temp
union use an _OBSTACK_SIZE_T integer type.
For __GNUC__ versions of the following macros...
(obstack_room): Rename local var.
(obstack_make_room): Use obstack_room.
(obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow,
obstack_int_grow, obstack_blank): Likewise.
(obstack_finish): Use unsigned comparison when comparing aligned
next_free against chunk_limit.
(obstack_free): Cast OBJ to remove possible const qualifier.
For !__GNUC__ versions of the following macros...
(obstack_make_room): Use obstack_room.
(obstack_grow, obstack_grow0, obstack_1grow, obstack_ptr_grow,
obstack_int_grow, obstack_blank): Likewise.
(obstack_finish): Use unsigned comparision when comparing aligned
next_free against chunk_limit.
(obstack_free): Use temp.p and same comparisons as __GNUC__ version.
* lib/obstack.c (_obstack_begin_worker): Make "size" parameter
_OBSTACK_SIZE_T.
(_obstack_begin, _obstack_begin_1): Likewise.
(_obstack_newchunk): Likewise for length parameter.  Use size_t locals.
(_obstack_memory_used): Return and use _OBSTACK_SIZE_T local.
lib/obstack.c
lib/obstack.h