rev, tail: replace hardcoded code by UTF8_POINT macro - sbase - suckless unix tools
 (HTM) git clone git://git.suckless.org/sbase
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 3de61ef1aa27a4a6b8cb44d169c4d8774eb3845b
 (DIR) parent 2a29857fe92157f6a31b965dc6d70fa3ab128bb4
 (HTM) Author: Elie Le Vaillant <eolien55@disroot.org>
       Date:   Thu, 19 Dec 2024 21:56:20 +0100
       
       rev, tail: replace hardcoded code by UTF8_POINT macro
       
       Diffstat:
         M rev.c                               |       2 +-
         M tail.c                              |       2 +-
       
       2 files changed, 2 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/rev.c b/rev.c
       @@ -25,7 +25,7 @@ rev(FILE *fp)
                        lf = n && line[n - 1] == '\n';
                        i = n -= lf;
                        for (n = 0; i--;) {
       -                        if ((line[i] & 0xC0) == 0x80) {
       +                        if (UTF8_POINT(line[i])) {
                                        n++;
                                } else {
                                        fwrite(line + i, 1, n + 1, stdout);
 (DIR) diff --git a/tail.c b/tail.c
       @@ -122,7 +122,7 @@ taketail(int fd, const char *fname, size_t count)
                        case 'm':  /* runes */
                                for (p = buf + len - 1, left = count; p >= buf; p--) {
                                        /* skip utf-8 continuation bytes */
       -                                if ((*p & 0xc0) == 0x80)
       +                                if (UTF8_POINT(*p))
                                                continue;
                                        left--;
                                        if (!left)