Page MenuHomeFreeBSD

D17903.id50190.diff
No OneTemporary

D17903.id50190.diff

Index: lib/libedit/chartype.c
===================================================================
--- lib/libedit/chartype.c
+++ lib/libedit/chartype.c
@@ -182,17 +182,11 @@
protected size_t
ct_enc_width(Char c)
{
- /* UTF-8 encoding specific values */
- if (c < 0x80)
- return 1;
- else if (c < 0x0800)
- return 2;
- else if (c < 0x10000)
- return 3;
- else if (c < 0x110000)
- return 4;
- else
- return 0; /* not a valid codepoint */
+ char buf[MB_LEN_MAX];
+ int size;
+ if ((size = ct_wctomb(buf, c)) < 0)
+ return 0;
+ return size;
}
protected ssize_t
Index: lib/libedit/editline.3
===================================================================
--- lib/libedit/editline.3
+++ lib/libedit/editline.3
@@ -183,8 +183,6 @@
locale set by the application program and never uses
.Xr setlocale 3
to change the locale.
-The only locales supported are UTF-8 and the default C or POSIX locale.
-If any other locale is set, behaviour is undefined.
.Sh LINE EDITING FUNCTIONS
The line editing functions use a common data structure,
.Fa EditLine ,
Index: lib/libedit/el.h
===================================================================
--- lib/libedit/el.h
+++ lib/libedit/el.h
@@ -56,8 +56,6 @@
#define NO_TTY 0x02
#define EDIT_DISABLED 0x04
#define UNBUFFERED 0x08
-#define CHARSET_IS_UTF8 0x10
-#define NARROW_HISTORY 0x40
typedef unsigned char el_action_t; /* Index to command array */
Index: lib/libedit/el.c
===================================================================
--- lib/libedit/el.c
+++ lib/libedit/el.c
@@ -99,10 +99,6 @@
* Initialize all the modules. Order is important!!!
*/
el->el_flags = 0;
- if (setlocale(LC_CTYPE, NULL) != NULL){
- if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
- el->el_flags |= CHARSET_IS_UTF8;
- }
if (terminal_init(el) == -1) {
el_free(el->el_prog);
@@ -293,8 +289,6 @@
void *ptr = va_arg(ap, void *);
rv = hist_set(el, func, ptr);
- if (!(el->el_flags & CHARSET_IS_UTF8))
- el->el_flags &= ~NARROW_HISTORY;
break;
}
Index: lib/libedit/eln.c
===================================================================
--- lib/libedit/eln.c
+++ lib/libedit/eln.c
@@ -238,7 +238,6 @@
hist_fun_t fun = va_arg(ap, hist_fun_t);
void *ptr = va_arg(ap, void *);
ret = hist_set(el, fun, ptr);
- el->el_flags |= NARROW_HISTORY;
break;
}
Index: lib/libedit/hist.h
===================================================================
--- lib/libedit/hist.h
+++ lib/libedit/hist.h
@@ -53,15 +53,12 @@
TYPE(HistEvent) ev; /* Event cookie */
} el_history_t;
-#define HIST_FUN_INTERNAL(el, fn, arg) \
+#ifdef WIDECHAR
+#define HIST_FUN(el, fn, arg) hist_convert(el, fn, arg)
+#else
+#define HIST_FUN(el, fn, arg) \
((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \
fn, arg)) == -1) ? NULL : (el)->el_history.ev.str)
-#ifdef WIDECHAR
-#define HIST_FUN(el, fn, arg) \
- (((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \
- HIST_FUN_INTERNAL(el, fn, arg))
-#else
-#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg)
#endif
Index: lib/libedit/read.c
===================================================================
--- lib/libedit/read.c
+++ lib/libedit/read.c
@@ -363,17 +363,6 @@
goto again;
}
case (size_t)-2:
- /*
- * We don't support other multibyte charsets.
- * The second condition shouldn't happen
- * and is here merely for additional safety.
- */
- if ((el->el_flags & CHARSET_IS_UTF8) == 0 ||
- cbp >= MB_LEN_MAX) {
- errno = EILSEQ;
- *cp = L'\0';
- return -1;
- }
/* Incomplete sequence, read another byte. */
goto again;
default:

File Metadata

Mime Type
text/plain
Expires
Tue, May 19, 1:33 PM (10 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33314225
Default Alt Text
D17903.id50190.diff (3 KB)

Event Timeline