diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-05 22:27:04 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-05 22:28:33 +0100 |
| commit | c1f4d263ec1004512cdd6b38b351eb2fe2321c22 (patch) | |
| tree | ff884393424694c79eb87d16f13b151ba0233ec7 /src/zunsetup.c | |
| parent | zinit is now an inline function (diff) | |
| download | libzahl-c1f4d263ec1004512cdd6b38b351eb2fe2321c22.tar.gz libzahl-c1f4d263ec1004512cdd6b38b351eb2fe2321c22.tar.bz2 libzahl-c1f4d263ec1004512cdd6b38b351eb2fe2321c22.tar.xz | |
Add memory pool, also let the user know that libzahl is not designed for cryptography
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zunsetup.c')
| -rw-r--r-- | src/zunsetup.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/zunsetup.c b/src/zunsetup.c index 184f96f..9926354 100644 --- a/src/zunsetup.c +++ b/src/zunsetup.c @@ -9,14 +9,20 @@ zunsetup(void) if (libzahl_set_up) { libzahl_set_up = 0; #define X(x)\ - zfree(x); + free(x->chars); LIST_TEMPS; #undef X #define X(x, f, v)\ - zfree(x); + free(x->chars); LIST_CONSTS; #undef X for (i = BITS_PER_CHAR; i--;) - zfree(libzahl_tmp_divmod_ds[i]); + free(libzahl_tmp_divmod_ds[i]->chars); + + for (i = sizeof(libzahl_pool) / sizeof(*libzahl_pool); i--;) { + while (libzahl_pool_n[i]--) + free(libzahl_pool[i][libzahl_pool_n[i]]); + free(libzahl_pool[i]); + } } } |
