changeset 13149:032e2e0776cc

49 open i18n bits should define charset_is_ascii for the rest of libc Reviewed by: garrett@nexenta.com Approved by: garrett@nexenta.com
author Richard Lowe <richlowe@richlowe.net>
date Wed, 18 Aug 2010 18:26:29 -0400
parents b1e671333462
children 88e4597d99f9
files usr/src/lib/libc/port/locale/ascii.c usr/src/lib/libc/port/locale/big5.c usr/src/lib/libc/port/locale/euc.c usr/src/lib/libc/port/locale/gb18030.c usr/src/lib/libc/port/locale/gb2312.c usr/src/lib/libc/port/locale/gbk.c usr/src/lib/libc/port/locale/mblocal.h usr/src/lib/libc/port/locale/mskanji.c usr/src/lib/libc/port/locale/none.c usr/src/lib/libc/port/locale/table.c usr/src/lib/libc/port/locale/utf8.c
diffstat 11 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libc/port/locale/ascii.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/ascii.c	Wed Aug 18 18:26:29 2010 -0400
@@ -73,6 +73,7 @@
 	__wcsnrtombs = _ascii_wcsnrtombs;
 	_CurrentRuneLocale = rl;
 	__ctype[520] = 1;
+	charset_is_ascii = 1;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/big5.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/big5.c	Wed Aug 18 18:26:29 2010 -0400
@@ -69,6 +69,7 @@
 	__mbsinit = _BIG5_mbsinit;
 	_CurrentRuneLocale = rl;
 	__ctype[520] = 2;
+	charset_is_ascii = 0;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/euc.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/euc.c	Wed Aug 18 18:26:29 2010 -0400
@@ -120,6 +120,7 @@
 	__mbrtowc = _EUC_mbrtowc;
 	__wcrtomb = _EUC_wcrtomb;
 	__mbsinit = _EUC_mbsinit;
+	charset_is_ascii = 0;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/gb18030.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/gb18030.c	Wed Aug 18 18:26:29 2010 -0400
@@ -66,6 +66,7 @@
 	__mbsinit = _GB18030_mbsinit;
 	_CurrentRuneLocale = rl;
 	__ctype[520] = 4;
+	charset_is_ascii = 0;
 
 	return (0);
 }
--- a/usr/src/lib/libc/port/locale/gb2312.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/gb2312.c	Wed Aug 18 18:26:29 2010 -0400
@@ -60,6 +60,7 @@
 	__wcrtomb = _GB2312_wcrtomb;
 	__mbsinit = _GB2312_mbsinit;
 	__ctype[520] = 2;
+	charset_is_ascii = 0;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/gbk.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/gbk.c	Wed Aug 18 18:26:29 2010 -0400
@@ -65,6 +65,7 @@
 	__mbsinit = _GBK_mbsinit;
 	_CurrentRuneLocale = rl;
 	__ctype[520] = 2;
+	charset_is_ascii = 0;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/mblocal.h	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/mblocal.h	Wed Aug 18 18:26:29 2010 -0400
@@ -62,6 +62,8 @@
 extern size_t (*__wcsnrtombs)(char *_RESTRICT_KYWD,
     const wchar_t **_RESTRICT_KYWD, size_t, size_t, mbstate_t *_RESTRICT_KYWD);
 
+extern int charset_is_ascii;
+
 size_t __mbsnrtowcs_std(wchar_t *_RESTRICT_KYWD, const char **_RESTRICT_KYWD,
     size_t, size_t, mbstate_t *_RESTRICT_KYWD);
 size_t __wcsnrtombs_std(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
--- a/usr/src/lib/libc/port/locale/mskanji.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/mskanji.c	Wed Aug 18 18:26:29 2010 -0400
@@ -67,6 +67,7 @@
 	__mbsinit = _MSKanji_mbsinit;
 	_CurrentRuneLocale = rl;
 	__ctype[520] = 2;
+	charset_is_ascii = 0;
 	return (0);
 }
 
--- a/usr/src/lib/libc/port/locale/none.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/none.c	Wed Aug 18 18:26:29 2010 -0400
@@ -80,6 +80,8 @@
 	 */
 	(void) memcpy(__ctype, __ctype_C, SZ_TOTAL);
 
+	charset_is_ascii = 1;
+
 	__ctype_mask = rl->__runetype;
 	__trans_upper = rl->__mapupper;
 	__trans_lower = rl->__maplower;
--- a/usr/src/lib/libc/port/locale/table.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/table.c	Wed Aug 18 18:26:29 2010 -0400
@@ -271,3 +271,9 @@
 
 int *__trans_lower = _DefaultRuneLocale.__maplower;
 int *__trans_upper = _DefaultRuneLocale.__mapupper;
+
+/*
+ * Used in various string routines to conditionalize versions optimized for
+ * the ASCII case
+ */
+int charset_is_ascii = 1;
--- a/usr/src/lib/libc/port/locale/utf8.c	Wed Aug 18 17:08:24 2010 -0700
+++ b/usr/src/lib/libc/port/locale/utf8.c	Wed Aug 18 18:26:29 2010 -0400
@@ -66,6 +66,8 @@
 	__wcsnrtombs = _UTF8_wcsnrtombs;
 	_CurrentRuneLocale = rl;
 
+	charset_is_ascii = 0;
+
 	/*
 	 * In theory up to 6 bytes can be used for the encoding,
 	 * but only encodings with more than 4 bytes are illegal.