From e2eba7c3a81ebcc5751c9383f2766c6aae86366c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 3 Jun 2024 17:51:58 +0200 Subject: Add U8C(), U16C(), and U32C() for view constants --- include/mbstring.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/mbstring.h b/include/mbstring.h index a2e0d19..309069b 100644 --- a/include/mbstring.h +++ b/include/mbstring.h @@ -13,6 +13,11 @@ ((struct u16view){__VA_OPT__(u##__VA_ARGS__, sizeof(u##__VA_ARGS__) - 1)}) #define U32(...) \ ((struct u32view){__VA_OPT__(U##__VA_ARGS__, sizeof(U##__VA_ARGS__) - 1)}) +/* clang-format off */ +#define U8C(s) {u8##s, sizeof(u8##s) - 1} +#define U16C(s) { u##s, sizeof (u##s) - 1} +#define U32C(s) { U##s, sizeof (U##s) - 1} +/* clang-format on */ #define VSHFT(sv, n) ((sv)->p += (n), (sv)->len -= (n)) -- cgit v1.2.3