From 99b1b6e74b9ded856466eccb998c762a3a7f1f45 Mon Sep 17 00:00:00 2001
From: Thomas Voss <mail@thomasvoss.com>
Date: Thu, 9 May 2024 03:09:53 +0200
Subject: Make the rest of the casemapping functions take custom allocators

---
 include/unicode/string.h | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

(limited to 'include')

diff --git a/include/unicode/string.h b/include/unicode/string.h
index 7da4385..e3d93ad 100644
--- a/include/unicode/string.h
+++ b/include/unicode/string.h
@@ -7,8 +7,6 @@
 #include "_charN_t.h"
 #include "_u8view.h"
 
-#define mlib_warn_trunc nodiscard("don’t forget to check for truncation")
-
 /* clang-format off */
 
 enum [[clang::flag_enum]] caseflags {
@@ -30,20 +28,19 @@ size_t u8gnext(struct u8view *, struct u8view *);
 size_t u8wnext(struct u8view *, struct u8view *);
 size_t u8wnext_human(struct u8view *, struct u8view *);
 
-[[mlib_warn_trunc]]
-size_t u8casefold(char8_t *restrict, size_t, struct u8view, enum caseflags);
-[[mlib_warn_trunc]]
-size_t u8lower(char8_t *restrict, size_t, struct u8view, enum caseflags);
-[[mlib_warn_trunc]]
-size_t u8title(char8_t *restrict, size_t, struct u8view, enum caseflags);
-[[nodiscard]]
-char8_t *u8upper(size_t *, struct u8view, enum caseflags, alloc_fn, void *);
+[[nodiscard]] char8_t *u8casefold(size_t *, struct u8view, enum caseflags,
+                                  alloc_fn, void *);
+[[nodiscard]] char8_t *u8lower(size_t *, struct u8view, enum caseflags,
+                               alloc_fn, void *);
+[[nodiscard]] char8_t *u8title(size_t *, struct u8view, enum caseflags,
+                               alloc_fn, void *);
+[[nodiscard]] char8_t *u8upper(size_t *, struct u8view, enum caseflags,
+                               alloc_fn, void *);
 
+constexpr double U8CASEFOLD_SCALE = 3;
 constexpr double U8LOWER_SCALE = 1.5;
 constexpr double U8LOWER_SCALE_LT = 3;
 constexpr double U8TITLE_SCALE = 3;
 constexpr double U8UPPER_SCALE = 3;
 
-#undef mlib_warn_trunc
-
 #endif /* !MLIB_UNICODE_STRING_H */
-- 
cgit v1.2.3