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