Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdlib / mbrlen.c
blob39e175e43b3ab2465e9533f4d9042d45b5768ec0
1 #include <reent.h>
2 #include <newlib.h>
3 #include <wchar.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <errno.h>
8 #ifdef _REENT_THREAD_LOCAL
9 _Thread_local _mbstate_t _tls_mbrlen_state;
10 #endif
12 size_t
13 mbrlen(const char *__restrict s, size_t n, mbstate_t *__restrict ps)
15 #ifdef _MB_CAPABLE
16 if (ps == NULL)
18 struct _reent *reent = _REENT;
20 _REENT_CHECK_MISC(reent);
21 ps = &(_REENT_MBRLEN_STATE(reent));
23 #endif
25 return mbrtowc(NULL, s, n, ps);