diff options
-rw-r--r-- | include/mbstring.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/mbstring.h b/include/mbstring.h index b6a769c..e487da5 100644 --- a/include/mbstring.h +++ b/include/mbstring.h @@ -8,7 +8,10 @@ #include "_rune.h" #include "_u8view.h" -#define U8V(s) ((struct u8view){.p = (s), .len = sizeof(s) - 1}) +#define U8(s) \ + _Generic((s), \ + nullptr_t: ((struct u8view){}), \ + default: ((struct u8view){.p = (s), .len = sizeof(s) - 1})) #define U8_ARGS(s) ((s).p), ((s).len) #define U8_ARGSP(s) (&(s).p), (&(s).len) |