[hackers] [libgrapheme] Add to rather than subtract from unsigned integer || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Mon, 1 Jun 2020 12:33:30 +0200 (CEST)

commit b487c712407a1e17168b8b89696f7569bc981bbf
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Mon Jun 1 12:32:09 2020 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Jun 1 12:32:09 2020 +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_AT_frign.de>

diff --git a/src/test_body.c b/src/test_body.c
index 08d2d9e..3cf445d 100644
--- a/src/test_body.c
+++ b/src/test_body.c
_AT_@ -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, " ");
                                 }
                         }
Received on Mon Jun 01 2020 - 12:33:30 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 01 2020 - 12:36:31 CEST