From a2fc726a6225ceb94dba367cf5acfe597ce11d74 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 29 Nov 2018 21:25:44 +0100 Subject: A bunch of stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- wcsndup.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'wcsndup.c') diff --git a/wcsndup.c b/wcsndup.c index ba4e009..5b8f7cc 100644 --- a/wcsndup.c +++ b/wcsndup.c @@ -6,15 +6,16 @@ wchar_t * libsimple_wcsndup(const wchar_t *s, size_t n) /* TODO test */ { - size_t n = wcsnlen(s, n), size; + size_t size; wchar_t *ret; + n = wcsnlen(s, n); if (LIBSIMPLE_UMUL_OVERFLOW_NONZERO(n + 1, sizeof(wchar_t), &size, SIZE_MAX)) { errno = ENOMEM; - enprintf(status, "wcsdup:"); + return NULL; } ret = aligned_alloc(_Alignof(wchar_t), size); if (!ret) - enprintf(status, "wcsdup:"); + return NULL; wmemcpy(ret, s, n); ret[n] = 0; return ret; -- cgit v1.2.3-70-g09d2