libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

commit b487c712407a1e17168b8b89696f7569bc981bbf
parent f2fce2eb1e47acdb12655fab7c1159bf31fa7ee2
Author: Laslo Hunhold <dev@frign.de>
Date:   Mon,  1 Jun 2020 12:32:09 +0200

Add to rather than subtract from unsigned integer

It doesn't make a difference here, as the array of test cases
can not be empty, but it makes sense to be consistent with resilient
programming.

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

Diffstat:
Msrc/test_body.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test_body.c b/src/test_body.c @@ -308,14 +308,14 @@ int main(void) for (j = 0; j < enc_test[i].exp_len; j++) { fprintf(stderr, "0x%x", enc_test[i].exp_arr[j]); - if (j != enc_test[i].exp_len - 1) { + if (j + 1 < enc_test[i].exp_len) { fprintf(stderr, " "); } } fprintf(stderr, "), but got ("); for (j = 0; j < len; j++) { fprintf(stderr, "0x%x", arr[j]); - if (j != len - 1) { + if (j + 1 < len) { fprintf(stderr, " "); } }