Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit Remove utf8_islead() mbrtowc() handles this just...



details:   https://anonhg.NetBSD.org/src/rev/9699be4f121f
branches:  trunk
changeset: 813666:9699be4f121f
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 11 16:08:47 2016 +0000

description:
Remove utf8_islead() mbrtowc() handles this just fine (Ingo Schwarze)

diffstat:

 lib/libedit/read.c |  18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)

diffs (46 lines):

diff -r 5f34f1df7d9c -r 9699be4f121f lib/libedit/read.c
--- a/lib/libedit/read.c        Thu Feb 11 13:36:00 2016 +0000
+++ b/lib/libedit/read.c        Thu Feb 11 16:08:47 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: read.c,v 1.72 2016/02/08 17:18:43 christos Exp $       */
+/*     $NetBSD: read.c,v 1.73 2016/02/11 16:08:47 christos Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)read.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: read.c,v 1.72 2016/02/08 17:18:43 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.73 2016/02/11 16:08:47 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -294,18 +294,6 @@
        return OKCMD;
 }
 
-#ifdef WIDECHAR
-/* utf8_islead():
- *     Test whether a byte is a leading byte of a UTF-8 sequence.
- */
-private int
-utf8_islead(int c)
-{
-       return c < 0x80 ||             /* single byte char */
-              (c >= 0xc2 && c <= 0xf4); /* start of multibyte sequence */
-}
-#endif
-
 /* read_char():
  *     Read a character from the tty.
  */
@@ -354,8 +342,6 @@
                mbstate_t mbs;
                size_t rbytes;
 again_lastbyte:
-               if (!utf8_islead((unsigned char)cbuf[0]))
-                       goto again; /* discard the byte we read and try again */
                ++cbp;
                /* This only works because UTF8 is stateless */
                memset(&mbs, 0, sizeof(mbs));



Home | Main Index | Thread Index | Old Index