mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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>
This commit is contained in:
parent
bf8b5e9042
commit
56638c28ad
2 changed files with 74 additions and 44 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue