diff options
Diffstat (limited to 'lib/unicode/string/u8title.c')
-rw-r--r-- | lib/unicode/string/u8title.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/unicode/string/u8title.c b/lib/unicode/string/u8title.c index 3a85f4d..c0637ff 100644 --- a/lib/unicode/string/u8title.c +++ b/lib/unicode/string/u8title.c @@ -2,6 +2,7 @@ #include <stdckdint.h> #include "_attrs.h" +#include "alloc.h" #include "macros.h" #include "mbstring.h" #include "unicode/prop.h" @@ -18,11 +19,9 @@ uprop_ccc_0_or_230(rune ch) } char8_t * -u8title(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, - void *alloc_ctx) +u8title(size_t *dstn, u8view_t sv, caseflags_t flags, allocator_t mem) { ASSUME(dstn != nullptr); - ASSUME(alloc != nullptr); struct tcctx ctx_t; struct lcctx ctx_l; @@ -52,7 +51,7 @@ u8title(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, return nullptr; } - char8_t *dst = alloc(alloc_ctx, nullptr, 0, bufsz, 1, alignof(char8_t)); + char8_t *dst = new(mem, typeof(*dst), bufsz); while (u8next(&ch, &sv)) { if (sv.p > word.p + word.len) { @@ -134,5 +133,5 @@ u8title(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, } *dstn = n; - return alloc(alloc_ctx, dst, bufsz, n, 1, alignof(char8_t)); + return resz(mem, dst, bufsz, n); } |