aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-03-10 17:25:09 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-03-10 17:25:09 +0200
commitc3d40a0dba2d4cff85ef78d06973aeacc778cc74 (patch)
treef94238037c1550d8d53df7092a8883ed780d0c99 /include
parent8abb53d6786b822ba777dd5ada337e6772da309f (diff)
Make optparse() use u8view’s for longopts
Diffstat (limited to 'include')
-rw-r--r--include/mbstring.h2
-rw-r--r--include/optparse.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/mbstring.h b/include/mbstring.h
index 3ac9277..9a95836 100644
--- a/include/mbstring.h
+++ b/include/mbstring.h
@@ -8,6 +8,8 @@
#include "__rune.h"
#include "__u8view.h"
+#define U8V(s) ((struct u8view){.p = (s), .len = sizeof(s) - 1})
+
/* clang-format off */
#define U8_BYTE_1(x) (((x) & 0x80) == 0x00)
#define U8_BYTE_2(x) (((x) & 0xE0) == 0xC0)
diff --git a/include/optparse.h b/include/optparse.h
index 70e4318..5d16e67 100644
--- a/include/optparse.h
+++ b/include/optparse.h
@@ -25,7 +25,7 @@ enum op_argkind {
struct op_option {
rune shortopt;
- const char8_t *longopt;
+ struct u8view longopt;
enum op_argkind argtype;
};