aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-06-03 17:51:58 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-06-03 17:51:58 +0200
commite2eba7c3a81ebcc5751c9383f2766c6aae86366c (patch)
treea9b363b6771ef9bf893ba077740d235d90e4918e
parent604b18befd9918a65a8f370a6051864fcda2f623 (diff)
Add U8C(), U16C(), and U32C() for view constants
-rw-r--r--include/mbstring.h5
1 files changed, 5 insertions, 0 deletions
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))