diff options
Diffstat (limited to 'src/u8c/u16.h.d')
-rw-r--r-- | src/u8c/u16.h.d/u16alloc.c | 14 | ||||
-rw-r--r-- | src/u8c/u16.h.d/u16free.c | 10 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/u8c/u16.h.d/u16alloc.c b/src/u8c/u16.h.d/u16alloc.c index 3906017..ce20ecb 100644 --- a/src/u8c/u16.h.d/u16alloc.c +++ b/src/u8c/u16.h.d/u16alloc.c @@ -18,12 +18,16 @@ # include <u8c/err.h> # include <u8c/u16.h> # include <uchar.h> -bool u8c_u16alloc(char16_t * * const _u16,size_t const _sz) { +struct u8c_u16alloc_tuple u8c_u16alloc(size_t const _sz) { + struct u8c_u16alloc_tuple ret = { + .stat = false, + }; char16_t * arr = NULL; if((arr = calloc(sizeof *arr,_sz)) == NULL) { - u8c_seterr(U"u8c_u16alloc: Unable to allocate resources (not enough memory?).",u8c_errtyp_badalloc); - return false; + u8c_seterr(u8c_errtyp_badalloc,U"u8c_u16alloc: Unable to allocate resources (not enough memory?)."); + ret.stat = true; + return ret; } - *_u16 = arr; - return false; + ret.u16 = arr; + return ret; } diff --git a/src/u8c/u16.h.d/u16free.c b/src/u8c/u16.h.d/u16free.c index d447562..43e7503 100644 --- a/src/u8c/u16.h.d/u16free.c +++ b/src/u8c/u16.h.d/u16free.c @@ -17,8 +17,10 @@ # include <stdint.h> # include <stdlib.h> # include <u8c/u16.h> -bool u8c_u16free(char16_t const * * const _u16) { - free((char16_t *)*_u16); - *_u16 = NULL; - return false; +struct u8c_u16free_tuple u8c_u16free(char16_t const * const restrict _u16) { + struct u8c_u16free_tuple ret = { + .stat = false, + }; + free((char16_t *)_u16); + return ret; } |