diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-04-26 23:17:02 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-04-26 23:17:02 +0200 |
| commit | c07798feb5475b47562d6f9e90a564fc1121d25e (patch) | |
| tree | d7c9577a9974ff8f04b000278c3937b26096ed0a /src/allocator.c | |
| parent | zzero1 did not guarantee that all arguments were evaulated exactly once, thus made static inline (diff) | |
| download | libzahl-c07798feb5475b47562d6f9e90a564fc1121d25e.tar.gz libzahl-c07798feb5475b47562d6f9e90a564fc1121d25e.tar.bz2 libzahl-c07798feb5475b47562d6f9e90a564fc1121d25e.tar.xz | |
Add, and use, libzahl_memfailure for conciseness, also fix possible unset errno
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/allocator.c')
| -rw-r--r-- | src/allocator.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/allocator.c b/src/allocator.c index 80668f1..10170ae 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -22,11 +22,8 @@ libzahl_realloc(z_t a, size_t need) a->chars = new; } else { a->chars = realloc(a->chars, new_size * sizeof(zahl_char_t)); - if (unlikely(!a->chars)) { - if (!errno) /* sigh... */ - errno = ENOMEM; - libzahl_failure(errno); - } + if (unlikely(!a->chars)) + libzahl_memfailure(); } a->alloced = new_size; } |
