From c3d40a0dba2d4cff85ef78d06973aeacc778cc74 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 10 Mar 2024 17:25:09 +0200 Subject: Make optparse() use u8view’s for longopts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mbstring.h | 2 ++ include/optparse.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') 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; }; -- cgit v1.2.3