aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gpgscm/scheme-private.h
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-11-16 10:29:34 +0000
committerJustus Winter <[email protected]>2016-11-22 11:09:47 +0000
commit66834eb838a8892d088f6b7332084a64d9f15008 (patch)
tree2e37430f40bd9364c05cbd99daebbb9cebc28391 /tests/gpgscm/scheme-private.h
parenttests: Delay querying the avaliable algorithms. (diff)
downloadgnupg-66834eb838a8892d088f6b7332084a64d9f15008.tar.gz
gnupg-66834eb838a8892d088f6b7332084a64d9f15008.zip
gpgscm: Use a static pool of cells for small integers.
* tests/gpgscm/scheme-private.h (struct scheme): New fields for the static integer cells. * tests/gpgscm/scheme.c (_alloc_cellseg): New function. (alloc_cellseg): Use the new function. (MAX_SMALL_INTEGER): New macro. (initialize_small_integers): New function. (mk_small_integer): Likewise. (mk_integer): Return a small integer if possible. (_s_return): Do not free 'op' if it is a small integer. (s_save): Use a small integer to box the opcode. (scheme_init_custom_alloc): Initialize small integers. (scheme_deinit): Free chunk of small integers. * tests/gpgscm/scheme.h (USE_SMALL_INTEGERS): New macro. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm/scheme-private.h')
-rw-r--r--tests/gpgscm/scheme-private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h
index aa7889441..2c5c749e9 100644
--- a/tests/gpgscm/scheme-private.h
+++ b/tests/gpgscm/scheme-private.h
@@ -119,6 +119,12 @@ pointer SHARP_HOOK; /* *sharp-hook* */
pointer COMPILE_HOOK; /* *compile-hook* */
#endif
+#if USE_SMALL_INTEGERS
+/* A fixed allocation of small integers. */
+void *integer_alloc;
+pointer integer_cells;
+#endif
+
pointer free_cell; /* pointer to top of free cells */
long fcells; /* # of free cells */
size_t inhibit_gc; /* nesting of gc_disable */