Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-03-03 12:28:45 +0300
committerCorinna Vinschen <corinna@vinschen.de>2009-03-03 12:28:45 +0300
commitd6cd9169dcb6d5f276c43fefe91428240d7552d3 (patch)
tree2d19fe80bda68861de179acfe4dd049e43d4caad /newlib/libc/stdlib
parente81ae92910761df9451d7513d9357ccf35b334c0 (diff)
* libc/locale/locale.c (_setlocale_r): New implementation based on
FreeBSD's setlocale. (currentlocale): New helper function. (loadlocale): Ditto. (__locale_charset): New function. (__locale_msgcharset): Rename from __locale_charset. * libc/ctype/local.h (__lc_ctype): Remove declaration. (__locale_charset): Declare. * libc/ctype/iswalpha.c (iswalpha): Call __locale_charset instead of using __lc_ctype directly. Only compare against the charset alone. * libc/ctype/iswblank.c (iswblank): Ditto. * libc/ctype/iswcntrl.c (iswcntrl): Ditto. * libc/ctype/iswprint.c (iswprint): Ditto. * libc/ctype/iswpunct.c (iswpunct): Ditto. * libc/ctype/iswspace.c (iswspace): Ditto. * libc/ctype/towlower.c (towlower): Ditto. * libc/ctype/towupper.c (towupper): Ditto. * libc/stdlib/mbtowc_r.c (_mbtowc_r): Ditto. * libc/stdlib/wctomb_r.c (_wctomb_r): Ditto. * libc/sys/linux/intl/loadmsgcat.c (_nl_init_domain_conv): Call __locale_msgcharset instead of __locale_charset.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/mbtowc_r.c12
-rw-r--r--newlib/libc/stdlib/wctomb_r.c12
2 files changed, 10 insertions, 14 deletions
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index 00021beff..693c06c2d 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -45,8 +45,6 @@ static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
/* we override the mbstate_t __count field for more complex encodings and use it store a state value */
#define __state __count
-extern char __lc_ctype[12];
-
int
_DEFUN (_mbtowc_r, (r, pwc, s, n, state),
struct _reent *r _AND
@@ -65,9 +63,9 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -2;
#ifdef _MB_CAPABLE
- if (strlen (__lc_ctype) <= 1)
+ if (strlen (__locale_charset ()) <= 1)
{ /* fall-through */ }
- else if (!strcmp (__lc_ctype, "C-UTF-8"))
+ else if (!strcmp (__locale_charset (), "UTF-8"))
{
int ch;
int i = 0;
@@ -221,7 +219,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
else
return -1;
}
- else if (!strcmp (__lc_ctype, "C-SJIS"))
+ else if (!strcmp (__locale_charset (), "SJIS"))
{
int ch;
int i = 0;
@@ -251,7 +249,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (__lc_ctype, "C-EUCJP"))
+ else if (!strcmp (__locale_charset (), "EUCJP"))
{
int ch;
int i = 0;
@@ -281,7 +279,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (__lc_ctype, "C-JIS"))
+ else if (!strcmp (__locale_charset (), "JIS"))
{
JIS_STATE curr_state;
JIS_ACTION action;
diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c
index b5205fcaa..7178514dc 100644
--- a/newlib/libc/stdlib/wctomb_r.c
+++ b/newlib/libc/stdlib/wctomb_r.c
@@ -8,8 +8,6 @@
/* for some conversions, we use the __count field as a place to store a state value */
#define __state __count
-extern char __lc_ctype[12];
-
int
_DEFUN (_wctomb_r, (r, s, wchar, state),
struct _reent *r _AND
@@ -22,9 +20,9 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
is 4, as is the case on cygwin. */
wint_t wchar = _wchar;
- if (strlen (__lc_ctype) <= 1)
+ if (strlen (__locale_charset ()) <= 1)
{ /* fall-through */ }
- else if (!strcmp (__lc_ctype, "C-UTF-8"))
+ else if (!strcmp (__locale_charset (), "UTF-8"))
{
if (s == NULL)
return 0; /* UTF-8 encoding is not state-dependent */
@@ -106,7 +104,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
return -1;
}
}
- else if (!strcmp (__lc_ctype, "C-SJIS"))
+ else if (!strcmp (__locale_charset (), "SJIS"))
{
unsigned char char2 = (unsigned char)wchar;
unsigned char char1 = (unsigned char)(wchar >> 8);
@@ -130,7 +128,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
}
}
}
- else if (!strcmp (__lc_ctype, "C-EUCJP"))
+ else if (!strcmp (__locale_charset (), "EUCJP"))
{
unsigned char char2 = (unsigned char)wchar;
unsigned char char1 = (unsigned char)(wchar >> 8);
@@ -154,7 +152,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state),
}
}
}
- else if (!strcmp (__lc_ctype, "C-JIS"))
+ else if (!strcmp (__locale_charset (), "JIS"))
{
int cnt = 0;
unsigned char char2 = (unsigned char)wchar;