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 --- 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 +++--- 15 files changed, 36 insertions(+), 36 deletions(-) (limited to 'lib/unicode') 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) -- cgit v1.2.3