diff options
Diffstat (limited to 'newlib/libc/stdlib/wctob.c')
-rw-r--r-- | newlib/libc/stdlib/wctob.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/newlib/libc/stdlib/wctob.c b/newlib/libc/stdlib/wctob.c index d97c01f24..eebaec84f 100644 --- a/newlib/libc/stdlib/wctob.c +++ b/newlib/libc/stdlib/wctob.c @@ -8,6 +8,7 @@ int wctob (wint_t wc) { + struct _reent *reent; mbstate_t mbs; unsigned char pmb[MB_LEN_MAX]; @@ -17,8 +18,9 @@ wctob (wint_t wc) /* Put mbs in initial state. */ memset (&mbs, '\0', sizeof (mbs)); - _REENT_CHECK_MISC(_REENT); + reent = _REENT; + _REENT_CHECK_MISC(reent); - return __wctomb (_REENT, (char *) pmb, wc, __locale_charset (), &mbs) == 1 + return __wctomb (reent, (char *) pmb, wc, __locale_charset (), &mbs) == 1 ? (int) pmb[0] : EOF; } |