libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / libroot / posix / wchar / mbtowc.c
blob3eb11c59c29f24a2f4c261b40ef38a0e5c0e5ba0
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
6 #include <errno.h>
8 #include <errno_private.h>
9 #include <wchar_private.h>
12 int
13 __mbtowc(wchar_t* pwc, const char* s, size_t n)
15 static mbstate_t internalMbState;
17 int result = __mbrtowc(pwc, s, n, &internalMbState);
18 if (result == -2) {
19 __set_errno(EILSEQ);
20 result = -1;
23 return result;
27 B_DEFINE_WEAK_ALIAS(__mbtowc, mbtowc);