gpgscm: Remove arbitrary limit on number of cell segments.
authorJustus Winter <justus@g10code.com>
Wed, 22 Mar 2017 15:22:57 +0000 (16:22 +0100)
committerJustus Winter <justus@g10code.com>
Fri, 7 Apr 2017 11:11:30 +0000 (13:11 +0200)
commit56638c28adc1bbe9fc052b92549a50935c0fe99c
tree96508f151b027fa4e1079c67c083b6ae9490de52
parentbf8b5e9042b3d86d419b2ac1987a9298c9d21500
gpgscm: Remove arbitrary limit on number of cell segments.

* tests/gpgscm/scheme-private.h (struct scheme): Remove fixed-size
arrays for cell segments, replace them with a pointer to the new
'struct cell_segment' instead.
* tests/gpgscm/scheme.c (struct cell_segment): New definition.
(_alloc_cellseg): Allocate the header within the segment, return a
pointer to the header.
(_dealloc_cellseg): New function.
(alloc_cellseg): Insert the segments into a list.
(_get_cell): Allocate a new segment if less than a quarter of
CELL_SIGSIZE is recovered during garbage collection.
(initialize_small_integers): Adapt callsite.
(gc): Walk the list of segments.
(scheme_init_custom_alloc): Remove initialization of removed field.
(scheme_deinit): Adapt deallocation.
--

Previously the number of cells that could be allocated was a
compile-time limit.  Remove this limit.

Signed-off-by: Justus Winter <justus@g10code.com>
tests/gpgscm/scheme-private.h
tests/gpgscm/scheme.c