(wrong string) ée

From: <git_AT_suckless.org>
Date: Tue, 1 Mar 2016 19:22:55 +0100 (CET)

commit ee47da9c3992a846f3fb236e7796dbb88d44819c
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Tue Mar 1 18:54:58 2016 +0100
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Tue Mar 1 18:54:58 2016 +0100

    Avoid using the internal structure as much as possible
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/src/zload.c b/src/zload.c
index 9e4521f..e03d911 100644
--- a/src/zload.c
+++ b/src/zload.c
_AT_@ -17,8 +17,8 @@ zload(z_t a, const void *buffer)
         } else {
                 a->chars = 0;
         }
- if (a->sign) {
+ if (!zzero(a)) {
                 memcpy(a->chars, buf, a->used * sizeof(*(a->chars)));
         }
- return sizeof(z_t) - sizeof(a->chars) + (a->sign ? a->used * sizeof(*(a->chars)) : 0);
+ return sizeof(z_t) - sizeof(a->chars) + (zzero(a) ? 0 : a->used * sizeof(*(a->chars)));
 }
diff --git a/src/zsave.c b/src/zsave.c
index 6f68387..6aa50b5 100644
--- a/src/zsave.c
+++ b/src/zsave.c
_AT_@ -12,9 +12,9 @@ zsave(z_t a, void *buffer)
                 *((int *)buf) = a->sign, buf += sizeof(int);
                 *((size_t *)buf) = a->used, buf += sizeof(size_t);
                 *((size_t *)buf) = a->alloced, buf += sizeof(size_t);
- if (a->sign) {
+ if (!zzero(a)) {
                         memcpy(buf, a->chars, a->used * sizeof(*(a->chars)));
                 }
         }
- return sizeof(z_t) - sizeof(a->chars) + (a->sign ? a->used * sizeof(*(a->chars)) : 0);
+ return sizeof(z_t) - sizeof(a->chars) + (zzero(a) ? 0 : a->used * sizeof(*(a->chars)));
 }
Received on Tue Mar 01 2016 - 19:22:55 CET

This archive was generated by hypermail 2.3.0 : Tue Mar 01 2016 - 19:24:20 CET