diff options
author | Justus Winter <justus@g10code.com> | 2016-11-16 11:29:34 +0100 |
---|---|---|
committer | Justus Winter <justus@g10code.com> | 2016-11-22 12:09:47 +0100 |
commit | 66834eb838a8892d088f6b7332084a64d9f15008 (patch) | |
tree | 2e37430f40bd9364c05cbd99daebbb9cebc28391 /tests/gpgscm/scheme.h | |
parent | tests: Delay querying the avaliable algorithms. (diff) | |
download | gnupg2-66834eb838a8892d088f6b7332084a64d9f15008.tar.xz gnupg2-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 <justus@g10code.com>
Diffstat (limited to '')
-rw-r--r-- | tests/gpgscm/scheme.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index 8e93177cb..2b5b0665c 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -43,6 +43,7 @@ extern "C" { # define USE_COMPILE_HOOK 0 # define USE_DL 0 # define USE_PLIST 0 +# define USE_SMALL_INTEGERS 0 #endif @@ -95,6 +96,13 @@ extern "C" { # define USE_THREADED_CODE 1 #endif +/* Use a static set of cells to represent small numbers. This set + * notably includes all opcodes, and hence saves a cell reservation + * during 's_save'. */ +#ifndef USE_SMALL_INTEGERS +# define USE_SMALL_INTEGERS 1 +#endif + #ifndef USE_STRCASECMP /* stricmp for Unix */ # define USE_STRCASECMP 0 #endif |