libgrapheme

Freestanding C library for unicode string handling
git clone https://git.sinitax.com/suckless/libgrapheme
Log | Files | Refs | README | LICENSE | sfeed.txt

commit c2aa140007c3fe8f6b58839668219e9c8414865b
parent 98e8632689b89f9f25d2a7091e7315f7d48881bc
Author: Laslo Hunhold <dev@frign.de>
Date:   Fri, 26 May 2023 12:19:55 +0200

Apply clang format

Signed-off-by: Laslo Hunhold <dev@frign.de>

Diffstat:
Mgen/bidirectional-test.c | 17+++++++++--------
Msrc/bidirectional.c | 4++--
Mtest/bidirectional.c | 6++++--
3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/gen/bidirectional-test.c b/gen/bidirectional-test.c @@ -130,7 +130,8 @@ strtolevel(const char *str, size_t len, int_least8_t *level) /* check if the string is completely numerical */ for (i = 0; i < len; i++) { if (str[i] < '0' && str[i] > '9') { - fprintf(stderr, "strtolevel: '%.*s' is not an integer.\n", + fprintf(stderr, + "strtolevel: '%.*s' is not an integer.\n", (int)len, str); return 1; } @@ -182,7 +183,8 @@ strtoreorder(const char *str, size_t len, int_least16_t *reorder) /* check if the string is completely numerical */ for (i = 0; i < len; i++) { if (str[i] < '0' && str[i] > '9') { - fprintf(stderr, "strtoreorder: '%.*s' is not an integer.\n", + fprintf(stderr, + "strtoreorder: '%.*s' is not an integer.\n", (int)len, str); return 1; } @@ -190,7 +192,7 @@ strtoreorder(const char *str, size_t len, int_least16_t *reorder) if (len == 3) { *reorder = (str[0] - '0') * 100 + (str[1] - '0') * 10 + - (str[2] - '0'); + (str[2] - '0'); } else if (len == 2) { *reorder = (str[0] - '0') * 10 + (str[1] - '0'); } else if (len == 1) { @@ -205,7 +207,6 @@ toolarge: return 1; } - static int parse_level_list(const char *str, int_least8_t **level, size_t *levellen) { @@ -274,8 +275,8 @@ parse_reorder_list(const char *str, int_least16_t **reorder, size_t *reorderlen) for (i = 0, tmp1 = tmp2 = str; tmp2 != NULL; i++) { tmp2 = strchr(tmp1, ' '); if (strtoreorder(tmp1, - tmp2 ? (size_t)(tmp2 - tmp1) : strlen(tmp1), - &((*reorder)[i]))) { + tmp2 ? (size_t)(tmp2 - tmp1) : strlen(tmp1), + &((*reorder)[i]))) { return 1; } if (tmp2 != NULL) { @@ -423,7 +424,7 @@ test_callback(const char *file, char **field, size_t nfields, char *comment, } free(current_reorder); parse_reorder_list(tmp, &current_reorder, - &current_reorder_len); + &current_reorder_len); } else { fprintf(stderr, "Unknown @-input-line.\n"); exit(1); @@ -549,7 +550,7 @@ character_test_callback(const char *file, char **field, size_t nfields, &(test[testlen - 1].cplen)); parse_level_list(field[3], &(test[testlen - 1].level), &tmp); parse_reorder_list(field[4], &(test[testlen - 1].reorder), - &(test[testlen - 1].reorderlen)); + &(test[testlen - 1].reorderlen)); /* parse paragraph-level-mode */ if (strlen(field[1]) != 1) { diff --git a/src/bidirectional.c b/src/bidirectional.c @@ -1400,8 +1400,8 @@ preprocess(HERODOTUS_READER *r, enum grapheme_bidirectional_direction override, /* store resolved paragraph level in output variable */ /* TODO use enum-type */ *resolved = (paragraph_level == 0) ? - GRAPHEME_BIDIRECTIONAL_DIRECTION_LTR : - GRAPHEME_BIDIRECTIONAL_DIRECTION_RTL; + GRAPHEME_BIDIRECTIONAL_DIRECTION_LTR : + GRAPHEME_BIDIRECTIONAL_DIRECTION_RTL; } if (buf == NULL) { diff --git a/test/bidirectional.c b/test/bidirectional.c @@ -43,8 +43,10 @@ main(int argc, char *argv[]) goto err; } - /* resolved paragraph level (if specified in the test) */ - if (bidirectional_test[i].resolved != GRAPHEME_BIDIRECTIONAL_DIRECTION_NEUTRAL && + /* resolved paragraph level (if specified in the test) + */ + if (bidirectional_test[i].resolved != + GRAPHEME_BIDIRECTIONAL_DIRECTION_NEUTRAL && resolved != bidirectional_test[i].resolved) { goto err; }