aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/mbstowcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/mbstowcs.c')
-rw-r--r--newlib/libc/stdlib/mbstowcs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c
index fee621a..eb0ccd7 100644
--- a/newlib/libc/stdlib/mbstowcs.c
+++ b/newlib/libc/stdlib/mbstowcs.c
@@ -50,6 +50,7 @@ effects vary with the locale.
#ifndef _REENT_ONLY
#include <stdlib.h>
+#include <wchar.h>
size_t
_DEFUN (mbstowcs, (pwcs, s, n),
@@ -58,7 +59,8 @@ _DEFUN (mbstowcs, (pwcs, s, n),
size_t n)
{
#ifdef MB_CAPABLE
- int state = 0;
+ mbstate_t state;
+ state.__count = 0;
return _mbstowcs_r (_REENT, pwcs, s, n, &state);
#else /* not MB_CAPABLE */