diff options
author | Mattias Andrée <maandree@kth.se> | 2018-11-29 21:25:44 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-11-29 21:25:44 +0100 |
commit | a2fc726a6225ceb94dba367cf5acfe597ce11d74 (patch) | |
tree | 7e6f705a9160b9bdad8f32463284009085dc7254 /wcsndup.c | |
parent | m (diff) | |
download | libsimple-a2fc726a6225ceb94dba367cf5acfe597ce11d74.tar.gz libsimple-a2fc726a6225ceb94dba367cf5acfe597ce11d74.tar.bz2 libsimple-a2fc726a6225ceb94dba367cf5acfe597ce11d74.tar.xz |
A bunch of stuff
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | wcsndup.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; |