aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-27 21:17:50 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-27 21:17:50 +0200
commit6f99a07cfa20a8af30b77f101e3195add723cc03 (patch)
tree343ebee4e496f032df4b67c16898c0579efdd84f
parentfddce452aef5c7371e138efedfbc1a460aa70f23 (diff)
Don’t handle U8(nullptr); use U8() instead.
-rw-r--r--include/mbstring.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/mbstring.h b/include/mbstring.h
index e487da5..06e32ae 100644
--- a/include/mbstring.h
+++ b/include/mbstring.h
@@ -8,10 +8,8 @@
#include "_rune.h"
#include "_u8view.h"
-#define U8(s) \
- _Generic((s), \
- nullptr_t: ((struct u8view){}), \
- default: ((struct u8view){.p = (s), .len = sizeof(s) - 1}))
+#define U8(...) \
+ ((struct u8view){__VA_OPT__(u8##__VA_ARGS__, sizeof(u8##__VA_ARGS__) - 1)})
#define U8_ARGS(s) ((s).p), ((s).len)
#define U8_ARGSP(s) (&(s).p), (&(s).len)