summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-05-15 19:06:02 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-05-15 19:06:02 +0000
commit53697af41915e1cfb67dca5711a18e8fff71d07a (patch)
treeb802ff734bd8d95bbae08ac3de905564a61c43c0 /usr.bin
parent371b3696dd13f4c9f4599e1bf4750975fff072d2 (diff)
trivial replacement of the home-grown IS_ASCII_OCTET()
with the standard isascii(3)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/less/charset.h1
-rw-r--r--usr.bin/less/cmdbuf.c2
-rw-r--r--usr.bin/less/cvt.c3
-rw-r--r--usr.bin/less/line.c2
4 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/less/charset.h b/usr.bin/less/charset.h
index 44fc03bd9da..fbeec21879d 100644
--- a/usr.bin/less/charset.h
+++ b/usr.bin/less/charset.h
@@ -9,7 +9,6 @@
* For more information, see the README file.
*/
-#define IS_ASCII_OCTET(c) (((c) & 0x80) == 0)
#define IS_UTF8_TRAIL(c) (((c) & 0xC0) == 0x80)
#define IS_UTF8_INVALID(c) (((c) & 0xFE) == 0xFE)
#define IS_UTF8_LEAD(c) (((c) & 0xC0) == 0xC0 && !IS_UTF8_INVALID(c))
diff --git a/usr.bin/less/cmdbuf.c b/usr.bin/less/cmdbuf.c
index e0a4e172fad..8965ea9b68f 100644
--- a/usr.bin/less/cmdbuf.c
+++ b/usr.bin/less/cmdbuf.c
@@ -1069,7 +1069,7 @@ cmd_char(int c)
retry:
cmd_mbc_buf_index = 1;
*cmd_mbc_buf = c & 0xff;
- if (IS_ASCII_OCTET(c))
+ if (isascii((unsigned char)c))
cmd_mbc_buf_len = 1;
else if (IS_UTF8_LEAD(c)) {
cmd_mbc_buf_len = utf_len(c);
diff --git a/usr.bin/less/cvt.c b/usr.bin/less/cvt.c
index 70a58851e36..2df36d5b21a 100644
--- a/usr.bin/less/cvt.c
+++ b/usr.bin/less/cvt.c
@@ -78,8 +78,7 @@ cvt_text(char *odst, char *osrc, int *chpos, int *lenp, int ops)
/* Delete backspace and preceding char. */
do {
dst--;
- } while (dst > odst &&
- !IS_ASCII_OCTET(*dst) && !IS_UTF8_LEAD(*dst));
+ } while (dst > odst && IS_UTF8_TRAIL(*dst));
} else if ((ops & CVT_ANSI) && ch == ESC) {
/* Skip to end of ANSI escape sequence. */
src++; /* skip the CSI start char */
diff --git a/usr.bin/less/line.c b/usr.bin/less/line.c
index 217da04d4ef..aa1a2b834fc 100644
--- a/usr.bin/less/line.c
+++ b/usr.bin/less/line.c
@@ -242,7 +242,7 @@ pshift(int shift)
}
continue;
}
- if (!IS_ASCII_OCTET(c) && utf_mode) {
+ if (utf_mode && !isascii(c)) {
wchar_t ch;
/*
* Before this point, UTF-8 validity was already