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:
Diffstat (limited to 'newlib/libc/stdlib/mbtowc_r.c')
-rw-r--r--newlib/libc/stdlib/mbtowc_r.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c
index 26141b4c2..c7c7effca 100644
--- a/newlib/libc/stdlib/mbtowc_r.c
+++ b/newlib/libc/stdlib/mbtowc_r.c
@@ -44,6 +44,8 @@ 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
@@ -62,10 +64,10 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -2;
#ifdef MB_CAPABLE
- if (r->_current_locale == NULL ||
- (strlen (r->_current_locale) <= 1))
+ if (__lc_ctype == NULL ||
+ (strlen (__lc_ctype) <= 1))
{ /* fall-through */ }
- else if (!strcmp (r->_current_locale, "C-UTF-8"))
+ else if (!strcmp (__lc_ctype, "C-UTF-8"))
{
int ch;
int i = 0;
@@ -307,7 +309,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
else
return -1;
}
- else if (!strcmp (r->_current_locale, "C-SJIS"))
+ else if (!strcmp (__lc_ctype, "C-SJIS"))
{
int ch;
int i = 0;
@@ -337,7 +339,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-EUCJP"))
+ else if (!strcmp (__lc_ctype, "C-EUCJP"))
{
int ch;
int i = 0;
@@ -367,7 +369,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state),
return -1;
}
}
- else if (!strcmp (r->_current_locale, "C-JIS"))
+ else if (!strcmp (__lc_ctype, "C-JIS"))
{
JIS_STATE curr_state;
JIS_ACTION action;