From c07798feb5475b47562d6f9e90a564fc1121d25e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 26 Apr 2016 23:17:02 +0200 Subject: Add, and use, libzahl_memfailure for conciseness, also fix possible unset errno MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/allocator.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/allocator.c') 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; } -- cgit v1.2.3-70-g09d2