aboutsummaryrefslogtreecommitdiffstats
path: root/src/allocator.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-04-26 23:17:02 +0200
committerMattias Andrée <maandree@kth.se>2016-04-26 23:17:02 +0200
commitc07798feb5475b47562d6f9e90a564fc1121d25e (patch)
treed7c9577a9974ff8f04b000278c3937b26096ed0a /src/allocator.c
parentzzero1 did not guarantee that all arguments were evaulated exactly once, thus made static inline (diff)
downloadlibzahl-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.c7
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;
}