Rev 4874 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | } |
41 | } |
Line 42... | Line 42... | ||
42 | 42 | ||
43 | #ifndef _REENT_ONLY |
43 | #ifndef _REENT_ONLY |
44 | size_t |
44 | size_t |
45 | _DEFUN (mbrtowc, (pwc, s, n, ps), |
45 | _DEFUN (mbrtowc, (pwc, s, n, ps), |
46 | wchar_t *pwc _AND |
46 | wchar_t *__restrict pwc _AND |
47 | const char *s _AND |
47 | const char *__restrict s _AND |
48 | size_t n _AND |
48 | size_t n _AND |
49 | mbstate_t *ps) |
49 | mbstate_t *__restrict ps) |
50 | { |
50 | { |
51 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
51 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
52 | return _mbrtowc_r (_REENT, pwc, s, n, ps); |
52 | return _mbrtowc_r (_REENT, pwc, s, n, ps); |
53 | #else |
53 | #else |
- | 54 | int retval = 0; |
|
Line 54... | Line 55... | ||
54 | int retval = 0; |
55 | struct _reent *reent = _REENT; |
55 | 56 | ||
56 | #ifdef _MB_CAPABLE |
57 | #ifdef _MB_CAPABLE |
57 | if (ps == NULL) |
58 | if (ps == NULL) |
58 | { |
59 | { |
59 | _REENT_CHECK_MISC(_REENT); |
60 | _REENT_CHECK_MISC(reent); |
60 | ps = &(_REENT_MBRTOWC_STATE(_REENT)); |
61 | ps = &(_REENT_MBRTOWC_STATE(reent)); |
Line 61... | Line 62... | ||
61 | } |
62 | } |
62 | #endif |
63 | #endif |
63 | 64 | ||
64 | if (s == NULL) |
65 | if (s == NULL) |
Line 65... | Line 66... | ||
65 | retval = __mbtowc (_REENT, NULL, "", 1, __locale_charset (), ps); |
66 | retval = __mbtowc (reent, NULL, "", 1, __locale_charset (), ps); |
66 | else |
67 | else |
67 | retval = __mbtowc (_REENT, pwc, s, n, __locale_charset (), ps); |
68 | retval = __mbtowc (reent, pwc, s, n, __locale_charset (), ps); |
68 | 69 | ||
69 | if (retval == -1) |
70 | if (retval == -1) |
70 | { |
71 | { |
71 | ps->__count = 0; |
72 | ps->__count = 0; |
72 | _REENT->_errno = EILSEQ; |
73 | reent->_errno = EILSEQ; |
73 | return (size_t)(-1); |
74 | return (size_t)(-1); |