aboutsummaryrefslogtreecommitdiff
path: root/lib/unicode/string/u8lower.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-10-03 00:36:26 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-10-03 00:36:26 +0200
commitd874d01e8e9a30f0073a6e559cbae07244dec7bf (patch)
treedbde18d7ada337b74fe6cfb8ccc35b52008e6aa0 /lib/unicode/string/u8lower.c
parent1e721a413f1d4fc7f7f4e1e691a0a37168f3b302 (diff)
Huge library overhaul
Diffstat (limited to 'lib/unicode/string/u8lower.c')
-rw-r--r--lib/unicode/string/u8lower.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/unicode/string/u8lower.c b/lib/unicode/string/u8lower.c
index 2b1ec36..e553f98 100644
--- a/lib/unicode/string/u8lower.c
+++ b/lib/unicode/string/u8lower.c
@@ -2,6 +2,7 @@
#include <stdckdint.h>
#include "_attrs.h"
+#include "alloc.h"
#include "macros.h"
#include "mbstring.h"
#include "unicode/prop.h"
@@ -17,11 +18,9 @@ uprop_ccc_0_or_230(rune ch)
}
char8_t *
-u8lower(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc,
- void *alloc_ctx)
+u8lower(size_t *dstn, u8view_t sv, caseflags_t flags, allocator_t mem)
{
ASSUME(dstn != nullptr);
- ASSUME(alloc != nullptr);
struct lcctx ctx = {
.az_or_tr = flags & CF_LANG_AZ,
@@ -46,7 +45,7 @@ u8lower(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)) {
rune next = 0;
@@ -103,5 +102,5 @@ u8lower(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);
}