From d8760ab5cf8378fa50e48453149e96a1392253e2 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 15 Sep 2024 19:20:44 +0200 Subject: Shorten the string view type names --- gen/prop/na | 6 ++-- gen/prop/na1 | 6 ++-- include/_uNview.h | 18 ++++++------ include/cli.h | 4 +-- include/macros.h | 2 +- include/mbstring.h | 59 +++++++++++++++++++------------------- include/unicode/prop.h | 6 ++-- include/unicode/string.h | 48 +++++++++++++++---------------- lib/cli/optparse.c | 24 ++++++++-------- lib/mbstring/u8chk.c | 2 +- lib/mbstring/u8chr.c | 2 +- lib/mbstring/u8cmp.c | 2 +- lib/mbstring/u8cspn.c | 2 +- lib/mbstring/u8cut.c | 2 +- lib/mbstring/u8haspfx.c | 2 +- lib/mbstring/u8hassfx.c | 2 +- lib/mbstring/u8len.c | 2 +- lib/mbstring/u8next.c | 2 +- lib/mbstring/u8rchr.c | 2 +- lib/mbstring/u8spn.c | 2 +- lib/unicode/prop/uprop_blkname.c | 4 +-- lib/unicode/prop/uprop_get_na.c | 6 ++-- lib/unicode/prop/uprop_get_na1.c | 6 ++-- lib/unicode/string/u8casefold.c | 2 +- lib/unicode/string/u8gcnt.c | 2 +- lib/unicode/string/u8gnext.c | 2 +- lib/unicode/string/u8lower.c | 6 ++-- lib/unicode/string/u8norm.c | 8 +++--- lib/unicode/string/u8title.c | 8 +++--- lib/unicode/string/u8upper.c | 2 +- lib/unicode/string/u8wcnt.c | 2 +- lib/unicode/string/u8wcnt_human.c | 2 +- lib/unicode/string/u8wdth.c | 2 +- lib/unicode/string/u8wnext.c | 14 ++++----- lib/unicode/string/u8wnext_human.c | 6 ++-- make.c | 6 ++-- man/u8len.3 | 4 +-- man/u8next.3 | 6 ++-- test/_brk-test.h | 14 ++++----- test/_case-test.h | 4 +-- test/_norm-test.h | 16 +++++------ test/wbrk-human-test.c | 12 ++++---- 42 files changed, 165 insertions(+), 164 deletions(-) diff --git a/gen/prop/na b/gen/prop/na index 250b746..2b80b3b 100755 --- a/gen/prop/na +++ b/gen/prop/na @@ -17,7 +17,7 @@ BEGIN { print "#define _(...) \\" print "\t{(const char8_t []){__VA_ARGS__}, sizeof((const char8_t []){__VA_ARGS__})}" print "" - print "static const struct u8view lookup[] = {" + print "static const u8view_t lookup[] = {" } $2 !~ /^ 0 { @@ -29,10 +29,10 @@ length($11) > 0 { END { print "};" print "" - print "struct u8view" + print "u8view_t" print "uprop_get_na1(rune ch)" print "{" - print "\treturn ch < lengthof(lookup) ? lookup[ch] : (struct u8view){};" + print "\treturn ch < lengthof(lookup) ? lookup[ch] : (u8view_t){};" print "}" } ' data/UnicodeData diff --git a/include/_uNview.h b/include/_uNview.h index 9d0d5e2..1001807 100644 --- a/include/_uNview.h +++ b/include/_uNview.h @@ -1,23 +1,23 @@ -#ifndef MLIB__U8VIEW_H -#define MLIB__U8VIEW_H +#ifndef MLIB__UNVIEW_H +#define MLIB__UNVIEW_H #include #include "_charN_t.h" -struct u8view { +typedef struct { const char8_t *p; size_t len; -}; +} u8view_t; -struct u16view { +typedef struct { const char16_t *p; size_t len; -}; +} u16view_t; -struct u32view { +typedef struct { const char32_t *p; size_t len; -}; +} u32view_t; -#endif /* !MLIB__U8VIEW_H */ +#endif /* !MLIB__UNVIEW_H */ diff --git a/include/cli.h b/include/cli.h index b2545ae..970b228 100644 --- a/include/cli.h +++ b/include/cli.h @@ -14,7 +14,7 @@ struct optparser { int optind; char errmsg[128]; - struct u8view optarg; + u8view_t optarg; }; enum cliarg { @@ -25,7 +25,7 @@ enum cliarg { struct cli_option { rune shortopt; - struct u8view longopt; + u8view_t longopt; enum cliarg argtype; }; diff --git a/include/macros.h b/include/macros.h index 74dd5e5..8f08364 100644 --- a/include/macros.h +++ b/include/macros.h @@ -11,7 +11,7 @@ #define streq(x, y) (!strcmp((x), (y))) #define u8eq(x, y) (!u8cmp((x), (y))) -#define ucseq(lhs, rhs) (!_Generic((lhs), struct u8view: u8cmp)((lhs), (rhs))) +#define ucseq(lhs, rhs) (!_Generic((lhs), u8view_t: u8cmp)((lhs), (rhs))) #define _MLIB_STR(s) #s #define _MLIB_CONCAT(x, y) x##y diff --git a/include/mbstring.h b/include/mbstring.h index 309069b..e28c479 100644 --- a/include/mbstring.h +++ b/include/mbstring.h @@ -7,17 +7,16 @@ #include "_rune.h" #include "_uNview.h" -#define U8(...) \ - ((struct u8view){__VA_OPT__(u8##__VA_ARGS__, sizeof(u8##__VA_ARGS__) - 1)}) -#define U16(...) \ - ((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 U8(...) \ + ((u8view_t){__VA_OPT__(u8##__VA_ARGS__, sizeof(u8##__VA_ARGS__) - 1)}) +#define U16(...) \ + ((u16view_t){__VA_OPT__(u##__VA_ARGS__, sizeof(u##__VA_ARGS__) - 1)}) +#define U32(...) \ + ((u32view_t){__VA_OPT__(U##__VA_ARGS__, sizeof(U##__VA_ARGS__) - 1)}) + #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)) @@ -41,41 +40,41 @@ constexpr rune MBEND = 0x110000; #define SV_PRI_ARGS(sv) ((int)(sv).len), ((sv).p) int rtou8(char8_t *, size_t, rune); -int u8next(rune *, struct u8view *); +int u8next(rune *, u8view_t *); int u8prev(rune *, const char8_t **, const char8_t *); int u8tor(rune *, const char8_t *); -[[nodiscard]] bool u8haspfx(struct u8view, struct u8view); -[[nodiscard]] bool u8hassfx(struct u8view, struct u8view); -[[nodiscard]] const char8_t *u8chk(struct u8view); -[[nodiscard]] const char8_t *u8chr(struct u8view, rune); -[[nodiscard]] const char8_t *u8rchr(struct u8view, rune); -[[nodiscard]] int u8cmp(struct u8view, struct u8view); -[[nodiscard]] size_t u8cspn(struct u8view, const rune *, size_t); -[[nodiscard]] size_t u8len(struct u8view); -[[nodiscard]] size_t u8spn(struct u8view, const rune *, size_t); -rune u8cut(struct u8view *restrict, struct u8view *restrict, const rune *, +[[nodiscard]] bool u8haspfx(u8view_t, u8view_t); +[[nodiscard]] bool u8hassfx(u8view_t, u8view_t); +[[nodiscard]] const char8_t *u8chk(u8view_t); +[[nodiscard]] const char8_t *u8chr(u8view_t, rune); +[[nodiscard]] const char8_t *u8rchr(u8view_t, rune); +[[nodiscard]] int u8cmp(u8view_t, u8view_t); +[[nodiscard]] size_t u8cspn(u8view_t, const rune *, size_t); +[[nodiscard]] size_t u8len(u8view_t); +[[nodiscard]] size_t u8spn(u8view_t, const rune *, size_t); +rune u8cut(u8view_t *restrict, u8view_t *restrict, const rune *, size_t); /* Encoding-generic macros */ #define rtoucs(buf, bufsz, ch) \ _Generic((buf), char8_t *: rtou8)((buf), (bufsz), (ch)) -#define ucsnext(ch, sv) _Generic((sv), struct u8view *: u8next)((ch), (sv)) +#define ucsnext(ch, sv) _Generic((sv), u8view_t *: u8next)((ch), (sv)) #define ucsprev(ch, p, start) \ _Generic((p), const char8_t **: u8prev)((ch), (p), (start)) #define ucstor(ch, p) \ _Generic((p), char8_t *: u8tor, const char8_t *: u8tor)((ch), (p)) -#define ucshaspfx(sv, pfx) _Generic((sv), struct u8view: u8haspfx)((sv), (pfx)) -#define ucshassfx(sv, sfx) _Generic((sv), struct u8view: u8hassfx)((sv), (sfx)) -#define ucschk(sv) _Generic((sv), struct u8view: u8chk)((sv)) -#define ucschr(sv, ch) _Generic((sv), struct u8view: u8chr)((sv), (ch)) -#define ucsrchr(sv, ch) _Generic((sv), struct u8view: u8rchr)((sv), (ch)) -#define ucscmp(lhs, rhs) _Generic((lhs), struct u8view: u8cmp)((lhs), (rhs)) +#define ucshaspfx(sv, pfx) _Generic((sv), u8view_t: u8haspfx)((sv), (pfx)) +#define ucshassfx(sv, sfx) _Generic((sv), u8view_t: u8hassfx)((sv), (sfx)) +#define ucschk(sv) _Generic((sv), u8view_t: u8chk)((sv)) +#define ucschr(sv, ch) _Generic((sv), u8view_t: u8chr)((sv), (ch)) +#define ucsrchr(sv, ch) _Generic((sv), u8view_t: u8rchr)((sv), (ch)) +#define ucscmp(lhs, rhs) _Generic((lhs), u8view_t: u8cmp)((lhs), (rhs)) #define ucscspn(sv, delims, ndelims) \ - _Generic((sv), struct u8view: u8cspn)((sv), (delims), (ndelims)) -#define ucslen(sv) _Generic((sv), struct u8view: u8len)((sv)) + _Generic((sv), u8view_t: u8cspn)((sv), (delims), (ndelims)) +#define ucslen(sv) _Generic((sv), u8view_t: u8len)((sv)) #define ucsspn(sv, delims, ndelims) \ - _Generic((sv), struct u8view: u8spn)((sv), (delims), (ndelims)) + _Generic((sv), u8view_t: u8spn)((sv), (delims), (ndelims)) #define ucscut(x, y, seps, nseps) \ - _Generic((y), struct u8view *: u8cut)(x, y, seps, nseps) + _Generic((y), u8view_t *: u8cut)(x, y, seps, nseps) #endif /* !MLIB_MBSTRING_H */ diff --git a/include/unicode/prop.h b/include/unicode/prop.h index e11aa21..a3498f0 100644 --- a/include/unicode/prop.h +++ b/include/unicode/prop.h @@ -1117,7 +1117,7 @@ enum uprop_wb : uint_least8_t { }; /* Not a Unicode property; but a nice-to-have */ -[[_mlib_pure]] struct u8view uprop_blkname(enum uprop_blk); +[[_mlib_pure]] u8view_t uprop_blkname(enum uprop_blk); [[_mlib_pure]] double uprop_get_nv(rune); [[_mlib_pure]] enum uprop_age uprop_get_age(rune); @@ -1159,8 +1159,8 @@ enum uprop_wb : uint_least8_t { [[_mlib_pure]] struct rview uprop_get_nfkc_scf(rune); [[_mlib_pure]] struct rview uprop_get_tc(rune, struct tcctx); [[_mlib_pure]] struct rview uprop_get_uc(rune, struct ucctx); -[[_mlib_pure]] struct u8view uprop_get_na1(rune); -[[_mlib_pure]] struct u8view uprop_get_na(rune); +[[_mlib_pure]] u8view_t uprop_get_na1(rune); +[[_mlib_pure]] u8view_t uprop_get_na(rune); [[_mlib_pure]] struct uprop_sc_view uprop_get_scx(rune); /* PROP PREDICATES START */ diff --git a/include/unicode/string.h b/include/unicode/string.h index 6908fe7..7d62171 100644 --- a/include/unicode/string.h +++ b/include/unicode/string.h @@ -30,47 +30,47 @@ enum normform { /* clang-format on */ -[[nodiscard]] size_t u8wdth(struct u8view, int); -[[nodiscard]] size_t u8gcnt(struct u8view); -[[nodiscard]] size_t u8wcnt(struct u8view); -[[nodiscard]] size_t u8wcnt_human(struct u8view); -size_t u8gnext(struct u8view *, struct u8view *); -size_t u8wnext(struct u8view *, struct u8view *); -size_t u8wnext_human(struct u8view *, struct u8view *); -[[nodiscard]] char8_t *u8casefold(size_t *, struct u8view, enum caseflags, +[[nodiscard]] size_t u8wdth(u8view_t, int); +[[nodiscard]] size_t u8gcnt(u8view_t); +[[nodiscard]] size_t u8wcnt(u8view_t); +[[nodiscard]] size_t u8wcnt_human(u8view_t); +size_t u8gnext(u8view_t *, u8view_t *); +size_t u8wnext(u8view_t *, u8view_t *); +size_t u8wnext_human(u8view_t *, u8view_t *); +[[nodiscard]] char8_t *u8casefold(size_t *, u8view_t, enum caseflags, alloc_fn, void *); -[[nodiscard]] char8_t *u8lower(size_t *, struct u8view, enum caseflags, +[[nodiscard]] char8_t *u8lower(size_t *, u8view_t, enum caseflags, alloc_fn, void *); -[[nodiscard]] char8_t *u8title(size_t *, struct u8view, enum caseflags, +[[nodiscard]] char8_t *u8title(size_t *, u8view_t, enum caseflags, alloc_fn, void *); -[[nodiscard]] char8_t *u8upper(size_t *, struct u8view, enum caseflags, +[[nodiscard]] char8_t *u8upper(size_t *, u8view_t, enum caseflags, alloc_fn, void *); -[[nodiscard]] char8_t *u8norm(size_t *, struct u8view, alloc_fn, void *, +[[nodiscard]] char8_t *u8norm(size_t *, u8view_t, alloc_fn, void *, enum normform); /* Encoding-generic macros */ -#define ucswdth(sv, ts) _Generic((sv), struct u8view: u8wdth)((sv), (ts)) -#define ucsgcnt(sv) _Generic((sv), struct u8view: u8gcnt)((sv)) -#define ucswcnt(sv) _Generic((sv), struct u8view: u8wcnt)((sv)) -#define ucswcnt_human(sv) _Generic((sv), struct u8view: u8wcnt_human)((sv)) -#define ucsgnext(g, sv) _Generic((sv), struct u8view *: u8gnext)((g), (sv)) -#define ucswnext(g, sv) _Generic((sv), struct u8view *: u8wnext)((g), (sv)) +#define ucswdth(sv, ts) _Generic((sv), u8view_t: u8wdth)((sv), (ts)) +#define ucsgcnt(sv) _Generic((sv), u8view_t: u8gcnt)((sv)) +#define ucswcnt(sv) _Generic((sv), u8view_t: u8wcnt)((sv)) +#define ucswcnt_human(sv) _Generic((sv), u8view_t: u8wcnt_human)((sv)) +#define ucsgnext(g, sv) _Generic((sv), u8view_t *: u8gnext)((g), (sv)) +#define ucswnext(g, sv) _Generic((sv), u8view_t *: u8wnext)((g), (sv)) #define ucswnext_human(g, sv) \ - _Generic((sv), struct u8view *: u8wnext_human)((g), (sv)) + _Generic((sv), u8view_t *: u8wnext_human)((g), (sv)) #define ucscasefold(dstn, sv, flags, alloc, ctx) \ - _Generic((sv), struct u8view: u8casefold)((dstn), (sv), (flags), (alloc), \ + _Generic((sv), u8view_t: u8casefold)((dstn), (sv), (flags), (alloc), \ (ctx)) #define ucslower(dstn, sv, flags, alloc, ctx) \ - _Generic((sv), struct u8view: u8lower)((dstn), (sv), (flags), (alloc), \ + _Generic((sv), u8view_t: u8lower)((dstn), (sv), (flags), (alloc), \ (ctx)) #define ucstitle(dstn, sv, flags, alloc, ctx) \ - _Generic((sv), struct u8view: u8title)((dstn), (sv), (flags), (alloc), \ + _Generic((sv), u8view_t: u8title)((dstn), (sv), (flags), (alloc), \ (ctx)) #define ucsupper(dstn, sv, flags, alloc, ctx) \ - _Generic((sv), struct u8view: u8upper)((dstn), (sv), (flags), (alloc), \ + _Generic((sv), u8view_t: u8upper)((dstn), (sv), (flags), (alloc), \ (ctx)) #define ucsnorm(dstn, sv, alloc, ctx, nf) \ - _Generic((sv), struct u8view: u8norm)((dstn), (sv), (alloc), (ctx), (nf)) + _Generic((sv), u8view_t: u8norm)((dstn), (sv), (alloc), (ctx), (nf)) constexpr double U8CASEFOLD_SCALE = 3; constexpr double U8LOWER_SCALE = 1.5; diff --git a/lib/cli/optparse.c b/lib/cli/optparse.c index 7134b37..8178b85 100644 --- a/lib/cli/optparse.c +++ b/lib/cli/optparse.c @@ -14,19 +14,19 @@ #define IS_SHORTOPT(s) ((s).len >= 2 && (s).p[0] == '-' && (s).p[1] != '-') #define error(st, msg, x) \ - _Generic((x), struct u8view: error_s, rune: error_r)((st), (msg), (x)) + _Generic((x), u8view_t: error_s, rune: error_r)((st), (msg), (x)) static rune error_r(struct optparser *, const char *, rune); -static rune error_s(struct optparser *, const char *, struct u8view); +static rune error_s(struct optparser *, const char *, u8view_t); static rune shortopt(struct optparser *, const struct cli_option *, size_t); rune optparse(struct optparser *st, const struct cli_option *opts, size_t nopts) { st->errmsg[0] = '\0'; - st->optarg = (struct u8view){}; + st->optarg = (u8view_t){}; - struct u8view opt = {.p = st->_argv[st->optind]}; + u8view_t opt = {.p = st->_argv[st->optind]}; if (opt.p == nullptr) return 0; opt.len = strlen(opt.p); @@ -48,13 +48,13 @@ optparse(struct optparser *st, const struct cli_option *opts, size_t nopts) const struct cli_option *o = nullptr; const char8_t *eq_p = u8chr(opt, '='); - struct u8view opt_no_eq = { + u8view_t opt_no_eq = { .p = opt.p, .len = eq_p == nullptr ? opt.len : (size_t)(eq_p - opt.p), }; for (size_t i = 0; i < nopts; i++) { - struct u8view lo = opts[i].longopt; + u8view_t lo = opts[i].longopt; if (lo.p == nullptr || !u8haspfx(lo, opt_no_eq)) continue; if (o != nullptr) @@ -72,10 +72,10 @@ optparse(struct optparser *st, const struct cli_option *opts, size_t nopts) break; case CLI_OPT: if (eq_p == nullptr) - st->optarg = (struct u8view){}; + st->optarg = (u8view_t){}; else { ASSUME(opt.len > opt_no_eq.len); - st->optarg = (struct u8view){ + st->optarg = (u8view_t){ .p = eq_p + 1, .len = opt.len - opt_no_eq.len + 1, }; @@ -89,7 +89,7 @@ optparse(struct optparser *st, const struct cli_option *opts, size_t nopts) st->optarg.len = strlen(st->optarg.p); } else { ASSUME(opt.len > opt_no_eq.len); - st->optarg = (struct u8view){ + st->optarg = (u8view_t){ .p = eq_p + 1, .len = opt.len - opt_no_eq.len + 1, }; @@ -124,11 +124,11 @@ shortopt(struct optparser *st, const struct cli_option *opts, size_t nopts) goto out; } if (opts[i].argtype == CLI_OPT) { - st->optarg = (struct u8view){}; + st->optarg = (u8view_t){}; goto out; } if (st->_argv[st->optind + 1] == nullptr) { - st->optarg = (struct u8view){}; + st->optarg = (u8view_t){}; return error(st, CLI_MSG_MISSING, ch); } st->optarg.p = st->_argv[st->optind + 1]; @@ -142,7 +142,7 @@ out: } rune -error_s(struct optparser *st, const char *msg, struct u8view s) +error_s(struct optparser *st, const char *msg, u8view_t s) { snprintf(st->errmsg, sizeof(st->errmsg), u8"%s — ‘%.*s’", msg, SV_PRI_ARGS(s)); diff --git a/lib/mbstring/u8chk.c b/lib/mbstring/u8chk.c index bf93005..332a450 100644 --- a/lib/mbstring/u8chk.c +++ b/lib/mbstring/u8chk.c @@ -2,7 +2,7 @@ #include "rune.h" const char8_t * -u8chk(struct u8view sv) +u8chk(u8view_t sv) { int w; rune ch; diff --git a/lib/mbstring/u8chr.c b/lib/mbstring/u8chr.c index 4831695..5ddcdd8 100644 --- a/lib/mbstring/u8chr.c +++ b/lib/mbstring/u8chr.c @@ -74,7 +74,7 @@ memmem4(const char8_t *h, size_t k, const char8_t *n) } const char8_t * -u8chr(struct u8view sv, rune ch) +u8chr(u8view_t sv, rune ch) { char8_t buf[U8_LEN_MAX]; int m = rtou8(buf, sizeof(buf), ch); diff --git a/lib/mbstring/u8cmp.c b/lib/mbstring/u8cmp.c index e54f984..5c56878 100644 --- a/lib/mbstring/u8cmp.c +++ b/lib/mbstring/u8cmp.c @@ -6,7 +6,7 @@ y.len both being 0 */ int -u8cmp(struct u8view x, struct u8view y) +u8cmp(u8view_t x, u8view_t y) { if (x.len != y.len) return x.len > y.len ? +1 : -1; diff --git a/lib/mbstring/u8cspn.c b/lib/mbstring/u8cspn.c index 827373f..cdeb659 100644 --- a/lib/mbstring/u8cspn.c +++ b/lib/mbstring/u8cspn.c @@ -1,7 +1,7 @@ #include "mbstring.h" size_t -u8cspn(struct u8view sv, const rune *p, size_t n) +u8cspn(u8view_t sv, const rune *p, size_t n) { rune ch; size_t k, w; diff --git a/lib/mbstring/u8cut.c b/lib/mbstring/u8cut.c index 3dd9663..36df561 100644 --- a/lib/mbstring/u8cut.c +++ b/lib/mbstring/u8cut.c @@ -2,7 +2,7 @@ #include "mbstring.h" rune -u8cut(struct u8view *restrict x, struct u8view *restrict y, const rune *seps, +u8cut(u8view_t *restrict x, u8view_t *restrict y, const rune *seps, size_t n) { ASSUME(y != nullptr); diff --git a/lib/mbstring/u8haspfx.c b/lib/mbstring/u8haspfx.c index c61efbb..abc5e76 100644 --- a/lib/mbstring/u8haspfx.c +++ b/lib/mbstring/u8haspfx.c @@ -4,7 +4,7 @@ #include "mbstring.h" bool -u8haspfx(struct u8view sv, struct u8view pfx) +u8haspfx(u8view_t sv, u8view_t pfx) { return sv.len >= pfx.len && memeq(sv.p, pfx.p, pfx.len); } diff --git a/lib/mbstring/u8hassfx.c b/lib/mbstring/u8hassfx.c index 8ea4456..ac72778 100644 --- a/lib/mbstring/u8hassfx.c +++ b/lib/mbstring/u8hassfx.c @@ -4,7 +4,7 @@ #include "mbstring.h" bool -u8hassfx(struct u8view sv, struct u8view sfx) +u8hassfx(u8view_t sv, u8view_t sfx) { return sv.len >= sfx.len && memeq(sv.p + sv.len - sfx.len, sfx.p, sfx.len); } diff --git a/lib/mbstring/u8len.c b/lib/mbstring/u8len.c index 23c55c5..26696a3 100644 --- a/lib/mbstring/u8len.c +++ b/lib/mbstring/u8len.c @@ -1,7 +1,7 @@ #include "mbstring.h" size_t -u8len(struct u8view sv) +u8len(u8view_t sv) { size_t m = 0; while (u8next(nullptr, &sv)) diff --git a/lib/mbstring/u8next.c b/lib/mbstring/u8next.c index 518de49..fe2dabf 100644 --- a/lib/mbstring/u8next.c +++ b/lib/mbstring/u8next.c @@ -1,7 +1,7 @@ #include "mbstring.h" int -u8next(rune *ch, struct u8view *sv) +u8next(rune *ch, u8view_t *sv) { int n = 0; diff --git a/lib/mbstring/u8rchr.c b/lib/mbstring/u8rchr.c index 825f8fd..47eaa4c 100644 --- a/lib/mbstring/u8rchr.c +++ b/lib/mbstring/u8rchr.c @@ -64,7 +64,7 @@ memrchr4(const char8_t *h, size_t k, const char8_t *n) } const char8_t * -u8rchr(struct u8view sv, rune ch) +u8rchr(u8view_t sv, rune ch) { char8_t buf[U8_LEN_MAX]; int n = rtou8(buf, ch, sizeof(buf)); diff --git a/lib/mbstring/u8spn.c b/lib/mbstring/u8spn.c index d41fcbc..f704ff8 100644 --- a/lib/mbstring/u8spn.c +++ b/lib/mbstring/u8spn.c @@ -1,7 +1,7 @@ #include "mbstring.h" size_t -u8spn(struct u8view sv, const rune *p, size_t n) +u8spn(u8view_t sv, const rune *p, size_t n) { rune ch; size_t k = 0, w; diff --git a/lib/unicode/prop/uprop_blkname.c b/lib/unicode/prop/uprop_blkname.c index 490f133..d55d731 100644 --- a/lib/unicode/prop/uprop_blkname.c +++ b/lib/unicode/prop/uprop_blkname.c @@ -4,7 +4,7 @@ #define _(...) \ {(const char8_t []){__VA_ARGS__}, sizeof((const char8_t []){__VA_ARGS__})} -static const struct u8view lookup[] = { +static const u8view_t lookup[] = { [BLK_NB] = _('N', 'o', ' ', 'B', 'l', 'o', 'c', 'k'), [BLK_ADLAM] = _('A', 'd', 'l', 'a', 'm'), [BLK_AEGEAN_NUMBERS] = _('A', 'e', 'g', 'e', 'a', 'n', ' ', 'N', 'u', 'm', 'b', 'e', 'r', 's'), @@ -336,7 +336,7 @@ static const struct u8view lookup[] = { [BLK_ZNAMENNY_MUSIC] = _('Z', 'n', 'a', 'm', 'e', 'n', 'n', 'y', ' ', 'M', 'u', 's', 'i', 'c', 'a', 'l', ' ', 'N', 'o', 't', 'a', 't', 'i', 'o', 'n'), }; -struct u8view +u8view_t uprop_blkname(enum uprop_blk blk) { ASSUME(blk < lengthof(lookup)); diff --git a/lib/unicode/prop/uprop_get_na.c b/lib/unicode/prop/uprop_get_na.c index f9df254..9b51838 100644 --- a/lib/unicode/prop/uprop_get_na.c +++ b/lib/unicode/prop/uprop_get_na.c @@ -7,7 +7,7 @@ #define _(...) \ {(const char8_t []){__VA_ARGS__}, sizeof((const char8_t []){__VA_ARGS__})} -static const struct u8view lookup[] = { +static const u8view_t lookup[] = { [RUNE_C(0x000020)] = _('S', 'P', 'A', 'C', 'E'), [RUNE_C(0x000021)] = _('E', 'X', 'C', 'L', 'A', 'M', 'A', 'T', 'I', 'O', 'N', ' ', 'M', 'A', 'R', 'K'), [RUNE_C(0x000022)] = _('Q', 'U', 'O', 'T', 'A', 'T', 'I', 'O', 'N', ' ', 'M', 'A', 'R', 'K'), @@ -34838,8 +34838,8 @@ static const struct u8view lookup[] = { [RUNE_C(0x0E01EF)] = _('V', 'A', 'R', 'I', 'A', 'T', 'I', 'O', 'N', ' ', 'S', 'E', 'L', 'E', 'C', 'T', 'O', 'R', '-', '2', '5', '6'), }; -struct u8view +u8view_t uprop_get_na(rune ch) { - return ch < lengthof(lookup) ? lookup[ch] : (struct u8view){}; + return ch < lengthof(lookup) ? lookup[ch] : (u8view_t){}; } diff --git a/lib/unicode/prop/uprop_get_na1.c b/lib/unicode/prop/uprop_get_na1.c index d1b9ec9..ac6fe06 100644 --- a/lib/unicode/prop/uprop_get_na1.c +++ b/lib/unicode/prop/uprop_get_na1.c @@ -7,7 +7,7 @@ #define _(...) \ {(const char8_t []){__VA_ARGS__}, sizeof((const char8_t []){__VA_ARGS__})} -static const struct u8view lookup[] = { +static const u8view_t lookup[] = { [RUNE_C(0x000000)] = _('N', 'U', 'L', 'L'), [RUNE_C(0x000001)] = _('S', 'T', 'A', 'R', 'T', ' ', 'O', 'F', ' ', 'H', 'E', 'A', 'D', 'I', 'N', 'G'), [RUNE_C(0x000002)] = _('S', 'T', 'A', 'R', 'T', ' ', 'O', 'F', ' ', 'T', 'E', 'X', 'T'), @@ -1988,8 +1988,8 @@ static const struct u8view lookup[] = { [RUNE_C(0x00FFE4)] = _('F', 'U', 'L', 'L', 'W', 'I', 'D', 'T', 'H', ' ', 'B', 'R', 'O', 'K', 'E', 'N', ' ', 'V', 'E', 'R', 'T', 'I', 'C', 'A', 'L', ' ', 'B', 'A', 'R'), }; -struct u8view +u8view_t uprop_get_na1(rune ch) { - return ch < lengthof(lookup) ? lookup[ch] : (struct u8view){}; + return ch < lengthof(lookup) ? lookup[ch] : (u8view_t){}; } diff --git a/lib/unicode/string/u8casefold.c b/lib/unicode/string/u8casefold.c index c7694a9..e3a3402 100644 --- a/lib/unicode/string/u8casefold.c +++ b/lib/unicode/string/u8casefold.c @@ -7,7 +7,7 @@ #include "unicode/string.h" char8_t * -u8casefold(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, +u8casefold(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { ASSUME(dstn != nullptr); diff --git a/lib/unicode/string/u8gcnt.c b/lib/unicode/string/u8gcnt.c index 6dfc519..bea30fa 100644 --- a/lib/unicode/string/u8gcnt.c +++ b/lib/unicode/string/u8gcnt.c @@ -1,7 +1,7 @@ #include "unicode/string.h" size_t -u8gcnt(struct u8view sv) +u8gcnt(u8view_t sv) { size_t m = 0; while (u8gnext(nullptr, &sv)) diff --git a/lib/unicode/string/u8gnext.c b/lib/unicode/string/u8gnext.c index 272711f..7c551f7 100644 --- a/lib/unicode/string/u8gnext.c +++ b/lib/unicode/string/u8gnext.c @@ -17,7 +17,7 @@ struct gbrk_state { static bool u8isgbrk(rune, rune, struct gbrk_state *); size_t -u8gnext(struct u8view *g, struct u8view *sv) +u8gnext(u8view_t *g, u8view_t *sv) { int m; rune ch1; diff --git a/lib/unicode/string/u8lower.c b/lib/unicode/string/u8lower.c index cd6a79f..2b1ec36 100644 --- a/lib/unicode/string/u8lower.c +++ b/lib/unicode/string/u8lower.c @@ -17,7 +17,7 @@ uprop_ccc_0_or_230(rune ch) } char8_t * -u8lower(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, +u8lower(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { ASSUME(dstn != nullptr); @@ -57,7 +57,7 @@ u8lower(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, if (before_dot_cnt == 0 || more_above_cnt == 0) { rune ch = 0; before_dot_cnt = more_above_cnt = 0; - struct u8view cpy = sv; + u8view_t cpy = sv; do { before_dot_cnt++; @@ -76,7 +76,7 @@ u8lower(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, if (final_sigma.after == 0) { rune ch = 0; - struct u8view cpy = sv; + u8view_t cpy = sv; do final_sigma.after++; diff --git a/lib/unicode/string/u8norm.c b/lib/unicode/string/u8norm.c index 91c6aa5..02156ea 100644 --- a/lib/unicode/string/u8norm.c +++ b/lib/unicode/string/u8norm.c @@ -39,7 +39,7 @@ static const qcfn qc_lookup[] = { }; char8_t * -u8norm(size_t *dstn, struct u8view src, alloc_fn alloc, void *ctx, +u8norm(size_t *dstn, u8view_t src, alloc_fn alloc, void *ctx, enum normform nf) { ASSUME(dstn != nullptr); @@ -48,7 +48,7 @@ u8norm(size_t *dstn, struct u8view src, alloc_fn alloc, void *ctx, { qcfn f = qc_lookup[nf]; - struct u8view sv = src; + u8view_t sv = src; enum uprop_ccc prvcc = 0, curcc; for (rune ch; ucsnext(&ch, &sv) != 0; prvcc = curcc) { curcc = uprop_get_ccc(ch); @@ -143,7 +143,7 @@ compbuf(char8_t *dst, size_t *dstn) { int wC, wL; rune C, L; - struct u8view sv = {dst, *dstn}; + u8view_t sv = {dst, *dstn}; while ((wL = ucsnext(&L, &sv)) != 0) { if (uprop_get_ccc(L) != CCC_NR) @@ -151,7 +151,7 @@ compbuf(char8_t *dst, size_t *dstn) char8_t *after_L = (char8_t *)sv.p; enum uprop_ccc prevcc = 0; - struct u8view sv_ = sv; + u8view_t sv_ = sv; while ((wC = ucsnext(&C, &sv_)) != 0) { enum uprop_ccc curcc = uprop_get_ccc(C); diff --git a/lib/unicode/string/u8title.c b/lib/unicode/string/u8title.c index 45bb37c..3a85f4d 100644 --- a/lib/unicode/string/u8title.c +++ b/lib/unicode/string/u8title.c @@ -18,7 +18,7 @@ uprop_ccc_0_or_230(rune ch) } char8_t * -u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, +u8title(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { ASSUME(dstn != nullptr); @@ -33,7 +33,7 @@ u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, rune ch; bool nl_IJ = false; size_t n, before_dot_cnt, more_above_cnt; - struct u8view word = {}, wcpy = sv; + u8view_t word = {}, wcpy = sv; struct { bool before; size_t after; @@ -65,7 +65,7 @@ u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, if (before_dot_cnt == 0 || more_above_cnt == 0) { rune ch = 0; before_dot_cnt = more_above_cnt = 0; - struct u8view cpy = sv; + u8view_t cpy = sv; do { before_dot_cnt++; @@ -84,7 +84,7 @@ u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, if (final_sigma.after == 0) { rune ch = 0; - struct u8view cpy = sv; + u8view_t cpy = sv; do final_sigma.after++; diff --git a/lib/unicode/string/u8upper.c b/lib/unicode/string/u8upper.c index 4c47613..a77fcd8 100644 --- a/lib/unicode/string/u8upper.c +++ b/lib/unicode/string/u8upper.c @@ -7,7 +7,7 @@ #include "unicode/string.h" char8_t * -u8upper(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, +u8upper(size_t *dstn, u8view_t sv, enum caseflags flags, alloc_fn alloc, void *alloc_ctx) { ASSUME(dstn != nullptr); diff --git a/lib/unicode/string/u8wcnt.c b/lib/unicode/string/u8wcnt.c index f71faf5..fb34dad 100644 --- a/lib/unicode/string/u8wcnt.c +++ b/lib/unicode/string/u8wcnt.c @@ -1,7 +1,7 @@ #include "unicode/string.h" size_t -u8wcnt(struct u8view sv) +u8wcnt(u8view_t sv) { size_t m = 0; while (u8wnext(nullptr, &sv)) diff --git a/lib/unicode/string/u8wcnt_human.c b/lib/unicode/string/u8wcnt_human.c index 60e7f95..f3377ee 100644 --- a/lib/unicode/string/u8wcnt_human.c +++ b/lib/unicode/string/u8wcnt_human.c @@ -1,7 +1,7 @@ #include "unicode/string.h" size_t -u8wcnt_human(struct u8view sv) +u8wcnt_human(u8view_t sv) { size_t m = 0; while (u8wnext_human(nullptr, &sv)) diff --git a/lib/unicode/string/u8wdth.c b/lib/unicode/string/u8wdth.c index 7a58069..db51b06 100644 --- a/lib/unicode/string/u8wdth.c +++ b/lib/unicode/string/u8wdth.c @@ -3,7 +3,7 @@ #include "unicode/string.h" size_t -u8wdth(struct u8view sv, int ts) +u8wdth(u8view_t sv, int ts) { rune ch; size_t n = 0; diff --git a/lib/unicode/string/u8wnext.c b/lib/unicode/string/u8wnext.c index 7590884..493ec9f 100644 --- a/lib/unicode/string/u8wnext.c +++ b/lib/unicode/string/u8wnext.c @@ -17,16 +17,16 @@ struct wbrk_state { struct { enum uprop_wbrk prev[2], next[2]; } raw, skip; - struct u8view raw_v, skip_v, mid_v; + u8view_t raw_v, skip_v, mid_v; int ri_parity : 1; }; static bool advance(struct wbrk_state *); -static size_t findwbrk(struct u8view); -static struct wbrk_state mkwbrkstate(struct u8view); +static size_t findwbrk(u8view_t); +static struct wbrk_state mkwbrkstate(u8view_t); size_t -u8wnext(struct u8view *w, struct u8view *sv) +u8wnext(u8view_t *w, u8view_t *sv) { ASSUME(sv != nullptr); ASSUME(sv->p != nullptr); @@ -36,7 +36,7 @@ u8wnext(struct u8view *w, struct u8view *sv) size_t off = findwbrk(*sv); if (w != nullptr) - *w = (struct u8view){sv->p, off}; + *w = (u8view_t){sv->p, off}; ASSUME(sv->len >= off); VSHFT(sv, off); @@ -44,7 +44,7 @@ u8wnext(struct u8view *w, struct u8view *sv) } size_t -findwbrk(struct u8view sv) +findwbrk(u8view_t sv) { ASSUME(sv.p != nullptr); @@ -177,7 +177,7 @@ findwbrk(struct u8view sv) } struct wbrk_state -mkwbrkstate(struct u8view sv) +mkwbrkstate(u8view_t sv) { struct wbrk_state ws = { .raw = {{WBRK_EOT, WBRK_EOT}, {WBRK_EOT, WBRK_EOT}}, diff --git a/lib/unicode/string/u8wnext_human.c b/lib/unicode/string/u8wnext_human.c index 953d942..0f750c9 100644 --- a/lib/unicode/string/u8wnext_human.c +++ b/lib/unicode/string/u8wnext_human.c @@ -4,15 +4,15 @@ #include "unicode/string.h" size_t -u8wnext_human(struct u8view *dst, struct u8view *sv) +u8wnext_human(u8view_t *dst, u8view_t *sv) { ASSUME(sv != nullptr); ASSUME(sv->p != nullptr); - struct u8view w; + u8view_t w; while (u8wnext(&w, sv)) { rune ch; - struct u8view cpy = w; + u8view_t cpy = w; while (u8next(&ch, &cpy)) { if (uprop_get_gc(ch) & (GC_L | GC_N)) { if (dst != nullptr) diff --git a/make.c b/make.c index a2fa75f..65c33c6 100644 --- a/make.c +++ b/make.c @@ -157,7 +157,8 @@ usage: for (size_t i = 0; i < g.gl_pathc; i++) g.gl_pathv[i][strlen(g.gl_pathv[i]) - 1] = 'o'; - if (flagset('a') && (flagset('f') || foutdated(LIBNAME ".a", g.gl_pathv, g.gl_pathc))) + if (flagset('a') + && (flagset('f') || foutdated(LIBNAME ".a", g.gl_pathv, g.gl_pathc))) { struct strs cmd = {}; strspushl(&cmd, "ar", "rcs", LIBNAME ".a"); @@ -170,7 +171,8 @@ usage: strsfree(&cmd); } - if (flagset('s') && (flagset('f') || foutdated(LIBNAME ".so", g.gl_pathv, g.gl_pathc))) + if (flagset('s') + && (flagset('f') || foutdated(LIBNAME ".so", g.gl_pathv, g.gl_pathc))) { struct strs cmd = {}; strspushenvl(&cmd, "CC", "cc"); diff --git a/man/u8len.3 b/man/u8len.3 index 5b51cd0..886bf6e 100644 --- a/man/u8len.3 +++ b/man/u8len.3 @@ -9,7 +9,7 @@ .Sh SYNOPSIS .In mbstring.h .Ft size_t -.Fn u8len "struct u8view sv" +.Fn u8len "u8view_t sv" .Sh DESCRIPTION The .Fn u8len @@ -32,7 +32,7 @@ will return 22 as a result of use of multibyte-characters in .Fa sv . .Bd -literal -offset indent size_t n; -struct u8view sv = U8(\(dq„Der Große Duden“\(dq); +u8view_t sv = U8(\(dq„Der Große Duden“\(dq); n = u8len(sv); /* 17 */ n = strlen((char *)sv.p); /* 22 */ diff --git a/man/u8next.3 b/man/u8next.3 index 68079f1..d556008 100644 --- a/man/u8next.3 +++ b/man/u8next.3 @@ -10,7 +10,7 @@ .Sh SYNOPSIS .In mbstring.h .Ft int -.Fn u8next "rune *ch" "struct u8view sv" +.Fn u8next "rune *ch" "u8view_t sv" .Ft int .Fn u8prev "rune *ch" "const char8_t **s" "const char8_t *start" .Sh DESCRIPTION @@ -60,7 +60,7 @@ iterate over and print all the codepoints in int w; rune ch; -struct u8view sv = U8("Ta’ Ħaġrat"); +u8view_t sv = U8("Ta’ Ħaġrat"); while (w = u8next(&ch, &sv)) printf("U+%04" PRIXRUNE ": ‘%.*s’\en", ch, w, sv.p - w); @@ -75,7 +75,7 @@ function to iterate backwards. int w; rune ch; -struct u8view sv = U8("Ta’ Ħaġrat"); +u8view_t sv = U8("Ta’ Ħaġrat"); const char8_t *s = sv.p + sv.len; while (w = u8prev(&ch, &s, sv.p)) diff --git a/test/_brk-test.h b/test/_brk-test.h index 21a6a2b..00b84ff 100644 --- a/test/_brk-test.h +++ b/test/_brk-test.h @@ -18,7 +18,7 @@ #define ITERFUNC CONCAT(CONCAT(ucs, BRKTYPE), next) #define CNTFUNC CONCAT(CONCAT(ucs, BRKTYPE), cnt) -static bool test(struct u8view, int); +static bool test(u8view_t, int); int main(int, char **argv) @@ -40,7 +40,7 @@ main(int, char **argv) if (line[nr - 1] == '\n') line[--nr] = '\0'; - if (!test((struct u8view){line, (size_t)nr}, id)) + if (!test((u8view_t){line, (size_t)nr}, id)) rv = EXIT_FAILURE; } if (ferror(fp)) @@ -52,7 +52,7 @@ main(int, char **argv) } bool -test(struct u8view sv, int id) +test(u8view_t sv, int id) { bool rv = true; size_t total = 0; @@ -67,7 +67,7 @@ test(struct u8view sv, int id) }; rune op; - struct u8view sv_cpy = sv; + u8view_t sv_cpy = sv; while ((op = ucscut(nullptr, &sv_cpy, U"×÷", 2)) != MBEND) { rune ch; sscanf(sv_cpy.p, "%" SCNxRUNE, &ch); @@ -88,7 +88,7 @@ test(struct u8view sv, int id) off += g->len; } - struct u8view buf = {p, total}; + u8view_t buf = {p, total}; /* Assert the item count is correct */ size_t items_got = CNTFUNC(buf); @@ -100,10 +100,10 @@ test(struct u8view sv, int id) } /* Assert the individual items are correct */ - struct u8view it1, buf_cpy = buf; + u8view_t it1, buf_cpy = buf; for (size_t i = 0; ITERFUNC(&it1, &buf_cpy); i++) { item it2 = items.buf[i]; - if (!ucseq(it1, ((struct u8view){it2.buf, it2.len}))) { + if (!ucseq(it1, ((u8view_t){it2.buf, it2.len}))) { warn("case %d: expected %s ‘%.*s’ but got ‘%.*s’", id, STR(BRKTYPE_LONG), (int)it2.len, it2.buf, SV_PRI_ARGS(it1)); rv = false; diff --git a/test/_case-test.h b/test/_case-test.h index 24a18f1..299f079 100644 --- a/test/_case-test.h +++ b/test/_case-test.h @@ -52,8 +52,8 @@ main(int, char **argv) bool test(const char8_t *line, int id) { - struct u8view mapped, sv = {line, strlen(line)}; - struct u8view before, after, flags; + u8view_t mapped, sv = {line, strlen(line)}; + u8view_t before, after, flags; ucscut(&before, &sv, U";", 1); ucscut(&after, &sv, U";", 1); ucscut(&flags, &sv, U";", 1); diff --git a/test/_norm-test.h b/test/_norm-test.h index 43f8731..744bc93 100644 --- a/test/_norm-test.h +++ b/test/_norm-test.h @@ -16,7 +16,7 @@ #define TESTFILE "norm.in" -static bool test(struct u8view, int); +static bool test(u8view_t, int); int main(int, char **argv) @@ -38,7 +38,7 @@ main(int, char **argv) if (line[nr - 1] == '\n') line[--nr] = '\0'; - if (!test((struct u8view){line, (size_t)nr}, id)) + if (!test((u8view_t){line, (size_t)nr}, id)) rv = EXIT_FAILURE; } if (ferror(fp)) @@ -50,18 +50,18 @@ main(int, char **argv) } bool -test(struct u8view sv, int id) +test(u8view_t sv, int id) { bool rv = true; arena a = mkarena(0); struct arena_ctx ctx = {.a = &a}; - dynarr(struct u8view) columns = { + dynarr(u8view_t) columns = { .alloc = alloc_arena, .ctx = &ctx, }; - struct u8view column; + u8view_t column; while (ucscut(&column, &sv, U";", 1) != MBEND) { dynarr(char8_t) s = { .alloc = alloc_arena, @@ -69,7 +69,7 @@ test(struct u8view sv, int id) }; rune _; - struct u8view cp; + u8view_t cp; do { rune ch; _ = ucscut(&cp, &column, U" ", 1); @@ -79,7 +79,7 @@ test(struct u8view sv, int id) DAEXTEND(&s, buf, w); } while (_ != MBEND); - DAPUSH(&columns, ((struct u8view){s.buf, s.len})); + DAPUSH(&columns, ((u8view_t){s.buf, s.len})); } for (size_t i = 0; i < 5; i++) { @@ -96,7 +96,7 @@ test(struct u8view sv, int id) else err("invalid NORMTYPE ‘%s’", nt); - struct u8view normd = {}; + u8view_t normd = {}; normd.p = ucsnorm(&normd.len, columns.buf[i], alloc_arena, &ctx, NORMTYPE); if (!ucseq(columns.buf[base], normd)) { diff --git a/test/wbrk-human-test.c b/test/wbrk-human-test.c index 24a3513..955cf4f 100644 --- a/test/wbrk-human-test.c +++ b/test/wbrk-human-test.c @@ -10,7 +10,7 @@ #define TESTFILE "wbrk-human.in" -static bool test(struct u8view, int); +static bool test(u8view_t, int); int main(int, char **argv) @@ -32,7 +32,7 @@ main(int, char **argv) if (line[nr - 1] == '\n') line[--nr] = '\0'; - if (!test((struct u8view){line, nr}, id)) + if (!test((u8view_t){line, nr}, id)) rv = EXIT_FAILURE; } if (ferror(fp)) @@ -44,13 +44,13 @@ main(int, char **argv) } bool -test(struct u8view sv, int id) +test(u8view_t sv, int id) { - struct u8view src; + u8view_t src; ucscut(&src, &sv, U";", 1); - struct u8view w; - dynarr(struct u8view) ws = {.alloc = alloc_heap}; + u8view_t w; + dynarr(u8view_t) ws = {.alloc = alloc_heap}; while (ucscut(&w, &sv, U"|", 1) != MBEND) DAPUSH(&ws, w); -- cgit v1.2.3