diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-03 23:02:59 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-03 23:02:59 +0100 |
| commit | d6987458f21cf1890045f2606d0f8ec4d2225b44 (patch) | |
| tree | 90afabbea01b01c4dedcb41748eb534ce04fbf77 /src/zsetu.c | |
| parent | zsets: minor optimisation (diff) | |
| download | libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.gz libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.bz2 libzahl-d6987458f21cf1890045f2606d0f8ec4d2225b44.tar.xz | |
Cleanup and fix bug in ztrunc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zsetu.c')
| -rw-r--r-- | src/zsetu.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/zsetu.c b/src/zsetu.c index c3c3510..2e60c28 100644 --- a/src/zsetu.c +++ b/src/zsetu.c @@ -1,8 +1,6 @@ /* See LICENSE file for copyright and license details. */ #include "internals" -#include <stdlib.h> - #define SIZE_MULTIPLE(fit, in) ((sizeof(fit) + sizeof(in) - 1) / sizeof(in)) @@ -13,10 +11,8 @@ zsetu(z_t a, unsigned long long int b) SET_SIGNUM(a, 0); return; } - if (a->alloced < SIZE_MULTIPLE(b, *(a->chars))) { - a->alloced = SIZE_MULTIPLE(b, *(a->chars)); - a->chars = realloc(a->chars, SIZE_MULTIPLE(b, *(a->chars)) * sizeof(*(a->chars))) - } + if (a->alloced < SIZE_MULTIPLE(b, *(a->chars))) + zahl_realloc(a, SIZE_MULTIPLE(b, *(a->chars))) SET_SIGNUM(a, 1); a->used = 0; while (b) { |
