aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-05-09 03:09:53 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-05-09 03:09:53 +0200
commit99b1b6e74b9ded856466eccb998c762a3a7f1f45 (patch)
tree50ac470fd46416b99c8d5788f4b02bb0a12daa58 /include
parent085b77730a553ce9769fcc76b68772dbde564004 (diff)
Make the rest of the casemapping functions take custom allocators
Diffstat (limited to 'include')
-rw-r--r--include/unicode/string.h21
1 files changed, 9 insertions, 12 deletions
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 */