9 #ifdef _REENT_THREAD_LOCAL
10 _Thread_local _mbstate_t _tls_wcrtomb_state
;
14 _wcrtomb_r (struct _reent
*ptr
,
25 _REENT_CHECK_MISC(ptr
);
26 ps
= &(_REENT_WCRTOMB_STATE(ptr
));
31 retval
= __WCTOMB (ptr
, buf
, L
'\0', ps
);
33 retval
= __WCTOMB (ptr
, s
, wc
, ps
);
38 _REENT_ERRNO(ptr
) = EILSEQ
;
42 return (size_t)retval
;
47 wcrtomb (char *__restrict s
,
49 mbstate_t *__restrict ps
)
51 #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
52 return _wcrtomb_r (_REENT
, s
, wc
, ps
);
55 struct _reent
*reent
= _REENT
;
61 _REENT_CHECK_MISC(reent
);
62 ps
= &(_REENT_WCRTOMB_STATE(reent
));
67 retval
= __WCTOMB (reent
, buf
, L
'\0', ps
);
69 retval
= __WCTOMB (reent
, s
, wc
, ps
);
74 _REENT_ERRNO(reent
) = EILSEQ
;
78 return (size_t)retval
;
79 #endif /* not PREFER_SIZE_OVER_SPEED */
81 #endif /* !_REENT_ONLY */