10 #ifdef _REENT_THREAD_LOCAL
11 _Thread_local _mbstate_t _tls_mbrtowc_state
;
15 _mbrtowc_r (struct _reent
*ptr
,
26 _REENT_CHECK_MISC(ptr
);
27 ps
= &(_REENT_MBRTOWC_STATE(ptr
));
32 retval
= __MBTOWC (ptr
, NULL
, "", 1, ps
);
34 retval
= __MBTOWC (ptr
, pwc
, s
, n
, ps
);
39 _REENT_ERRNO(ptr
) = EILSEQ
;
43 return (size_t)retval
;
48 mbrtowc (wchar_t *__restrict pwc
,
49 const char *__restrict s
,
51 mbstate_t *__restrict ps
)
53 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
54 return _mbrtowc_r (_REENT
, pwc
, s
, n
, ps
);
57 struct _reent
*reent
= _REENT
;
62 _REENT_CHECK_MISC(reent
);
63 ps
= &(_REENT_MBRTOWC_STATE(reent
));
68 retval
= __MBTOWC (reent
, NULL
, "", 1, ps
);
70 retval
= __MBTOWC (reent
, pwc
, s
, n
, ps
);
75 _REENT_ERRNO(reent
) = EILSEQ
;
79 return (size_t)retval
;
80 #endif /* not PREFER_SIZE_OVER_SPEED */
82 #endif /* !_REENT_ONLY */