From bd5a2308f2873c6b28527d5cebd2d2d160ebf9ba Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 4 Jun 2024 23:28:20 +0200 Subject: Formatting --- include/macros.h | 6 +++--- lib/mbstring/u8chk.c | 2 +- lib/mbstring/u8prev.c | 5 +++-- lib/mbstring/u8tor.c | 4 ++-- lib/unicode/string/u8title.c | 8 ++++---- lib/unicode/string/u8wnext.c | 8 ++++---- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/include/macros.h b/include/macros.h index 5c38215..74dd5e5 100644 --- a/include/macros.h +++ b/include/macros.h @@ -24,9 +24,9 @@ # define ASSUME(p) ((p) ? (void)0 : unreachable()) #else # include "errors.h" -# define ASSUME(p) \ - ((p) ? (void)0 \ - : err("%s:%s:%d: assumption ā€˜%sā€™ failed", __FILE__, __func__, \ +# define ASSUME(p) \ + ((p) ? (void)0 \ + : err("%s:%s:%d: assumption ā€˜%sā€™ failed", __FILE__, __func__, \ __LINE__, #p)) #endif diff --git a/lib/mbstring/u8chk.c b/lib/mbstring/u8chk.c index 20c4f3f..bf93005 100644 --- a/lib/mbstring/u8chk.c +++ b/lib/mbstring/u8chk.c @@ -1,5 +1,5 @@ -#include "rune.h" #include "mbstring.h" +#include "rune.h" const char8_t * u8chk(struct u8view sv) diff --git a/lib/mbstring/u8prev.c b/lib/mbstring/u8prev.c index ff580c2..2f8213e 100644 --- a/lib/mbstring/u8prev.c +++ b/lib/mbstring/u8prev.c @@ -23,11 +23,12 @@ u8prev(rune *ch, const char8_t **p, const char8_t *start) } else if (d > 2 && u8bytec(s[-1]) && u8bytec(s[-2]) && u8byte3(s[-3])) { if (ch) { *ch = ((s[-3] & 0x0F) << 12) | ((s[-2] & 0x3F) << 6) - | (s[-1] & 0x3F); + | (s[-1] & 0x3F); } off = 3; } else if (d > 3 && u8bytec(s[-1]) && u8bytec(s[-2]) && u8bytec(s[-3]) - && u8byte4(s[-4])) { + && u8byte4(s[-4])) + { if (ch) { *ch = ((s[-4] & 0x07) << 18) | ((s[-3] & 0x3F) << 12) | ((s[-2] & 0x3F) << 6) | (s[-1] & 0x3F); diff --git a/lib/mbstring/u8tor.c b/lib/mbstring/u8tor.c index eb54689..fddc97c 100644 --- a/lib/mbstring/u8tor.c +++ b/lib/mbstring/u8tor.c @@ -13,8 +13,8 @@ u8tor(rune *ch, const char8_t *s) } else if (u8byte3(s[0]) && u8bytec(s[1]) && u8bytec(s[2])) { *ch = ((s[0] & 0x0F) << 12) | ((s[1] & 0x3F) << 6) | (s[2] & 0x3F); return 3; - } else if (u8byte4(s[0]) && u8bytec(s[1]) && u8bytec(s[2]) - && u8bytec(s[3])) { + } else if (u8byte4(s[0]) && u8bytec(s[1]) && u8bytec(s[2]) && u8bytec(s[3])) + { *ch = ((s[0] & 0x07) << 18) | ((s[1] & 0x3F) << 12) | ((s[2] & 0x3F) << 6) | (s[3] & 0x3F); return 4; diff --git a/lib/unicode/string/u8title.c b/lib/unicode/string/u8title.c index 53855b6..45bb37c 100644 --- a/lib/unicode/string/u8title.c +++ b/lib/unicode/string/u8title.c @@ -112,16 +112,16 @@ u8title(size_t *dstn, struct u8view sv, enum caseflags flags, alloc_fn alloc, rune next = 0; if (sv.len > 0) u8tor(&next, sv.p); - nl_IJ = - (ch == 'i' || ch == 'I') && (next == 'j' || next == 'J'); + nl_IJ = (ch == 'i' || ch == 'I') + && (next == 'j' || next == 'J'); } } for (size_t i = 0; i < rv.len; i++) n += rtou8(dst + n, bufsz - n, rv.p[i]); - ctx_l.after_I = - (ch == 'I') || (ctx_l.after_I && !uprop_ccc_0_or_230(ch)); + ctx_l.after_I = (ch == 'I') + || (ctx_l.after_I && !uprop_ccc_0_or_230(ch)); if (uprop_is_cased(ch)) final_sigma.before = true; else if (!uprop_is_ci(ch)) diff --git a/lib/unicode/string/u8wnext.c b/lib/unicode/string/u8wnext.c index 074994e..7590884 100644 --- a/lib/unicode/string/u8wnext.c +++ b/lib/unicode/string/u8wnext.c @@ -8,9 +8,9 @@ #include "unicode/string.h" #define IS_MIDNUMLETQ(xp) ((xp) == WBRK_MB || (xp) == WBRK_SQ) -#define IS_AHLETTER(xp) \ +#define IS_AHLETTER(xp) \ ((xp) == WBRK_LE || (xp) == WBRK_EXTPICT_LE || (xp) == WBRK_HL) -#define IS_IGNORE(xp) \ +#define IS_IGNORE(xp) \ ((xp) == WBRK_EXTEND || (xp) == WBRK_FO || (xp) == WBRK_ZWJ) struct wbrk_state { @@ -218,8 +218,8 @@ advance(struct wbrk_state *ws) ws->raw.prev[1] = ws->raw.prev[0]; ws->raw.prev[0] = ws->raw.next[0]; ws->raw.next[0] = ws->raw.next[1]; - ws->raw.next[1] = - u8next(&ch, &ws->raw_v) != 0 ? uprop_get_wbrk(ch) : WBRK_EOT; + ws->raw.next[1] = u8next(&ch, &ws->raw_v) != 0 ? uprop_get_wbrk(ch) + : WBRK_EOT; /* Increment the midpoint */ u8next(nullptr, &ws->mid_v); -- cgit v1.2.3