diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-03-05 20:16:14 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-03-05 20:16:14 +0100 |
| commit | 5860237d2f05f6ae45a98569b0d567c2227904c6 (patch) | |
| tree | bbddb91e2a6a5e7efe7825971c726a9e4db87dd6 /src/zload.c | |
| parent | More detailed description of division and modulus (diff) | |
| download | libzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.gz libzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.bz2 libzahl-5860237d2f05f6ae45a98569b0d567c2227904c6.tar.xz | |
Fix bugs and add a randomised testing
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/zload.c')
| -rw-r--r-- | src/zload.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/zload.c b/src/zload.c index a77ae57..3ab939d 100644 --- a/src/zload.c +++ b/src/zload.c @@ -8,12 +8,9 @@ zload(z_t a, const void *buffer) const char *buf = buffer; a->sign = *((const int *)buf), buf += sizeof(int); a->used = *((const size_t *)buf), buf += sizeof(size_t); - a->alloced = 0; - if (a->sign) + if (a->sign) { ENSURE_SIZE(a, a->used); - else - a->chars = 0; - if (!zzero(a)) zmemcpy(a->chars, buf, a->used); + } return sizeof(int) + sizeof(size_t) + (zzero(a) ? 0 : a->used * sizeof(zahl_char_t)); } |
