diff options
author | Justus Winter <[email protected]> | 2017-03-22 15:22:57 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-04-07 11:11:30 +0000 |
commit | 56638c28adc1bbe9fc052b92549a50935c0fe99c (patch) | |
tree | 96508f151b027fa4e1079c67c083b6ae9490de52 /tests/gpgscm/scheme-private.h | |
parent | gpgscm: Fix compact vector encoding. (diff) | |
download | gnupg-56638c28adc1bbe9fc052b92549a50935c0fe99c.tar.gz gnupg-56638c28adc1bbe9fc052b92549a50935c0fe99c.zip |
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 <[email protected]>
Diffstat (limited to 'tests/gpgscm/scheme-private.h')
-rw-r--r-- | tests/gpgscm/scheme-private.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index fe501355d..093442f65 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -108,12 +108,7 @@ int tracing; #ifndef CELL_SEGSIZE #define CELL_SEGSIZE 5000 /* # of cells in one segment */ #endif -#ifndef CELL_NSEGMENT -#define CELL_NSEGMENT 10 /* # of segments for cells */ -#endif -void *alloc_seg[CELL_NSEGMENT]; -pointer cell_seg[CELL_NSEGMENT]; -int last_cell_seg; +struct cell_segment *cell_segments; /* We use 4 registers. */ pointer args; /* register for arguments of function */ @@ -159,8 +154,7 @@ pointer COMPILE_HOOK; /* *compile-hook* */ #if USE_SMALL_INTEGERS /* A fixed allocation of small integers. */ -void *integer_alloc; -pointer integer_cells; +struct cell_segment *integer_segment; #endif pointer free_cell; /* pointer to top of free cells */ |