aboutsummaryrefslogtreecommitdiffstats
path: root/src/zload.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/zload.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/zload.c b/src/zload.c
index ff54afb..a77ae57 100644
--- a/src/zload.c
+++ b/src/zload.c
@@ -6,15 +6,14 @@ size_t
zload(z_t a, const void *buffer)
{
const char *buf = buffer;
- size_t alloced;
a->sign = *((const int *)buf), buf += sizeof(int);
a->used = *((const size_t *)buf), buf += sizeof(size_t);
- alloced = *((const size_t *)buf), buf += sizeof(size_t);
- if (alloced)
- ENSURE_SIZE(a, alloced);
+ a->alloced = 0;
+ if (a->sign)
+ ENSURE_SIZE(a, a->used);
else
a->chars = 0;
if (!zzero(a))
zmemcpy(a->chars, buf, a->used);
- return sizeof(z_t) - sizeof(a->chars) + (zzero(a) ? 0 : a->used * sizeof(*(a->chars)));
+ return sizeof(int) + sizeof(size_t) + (zzero(a) ? 0 : a->used * sizeof(zahl_char_t));
}