about summary refs log tree commit diff
path: root/wcsmbs/mbrtowc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-19 07:29:43 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-19 07:29:43 +0000
commit6a07e1f8df9bee9a7d8bd87f27d796bd671a5109 (patch)
tree3e4d935fe8a8662db3048b9abf32332888322ba7 /wcsmbs/mbrtowc.c
parenta5334a6807f9ee2b321c78483a0519e82aa667aa (diff)
downloadglibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.tar.gz
glibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.tar.xz
glibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.zip
Update.
	* wcsmbs/mbrtowc.c: Create temporary state object if no output is
	written.
	* wcsmbs/mbsrtowcs.c: Likewise.
	* wcsmbs/wcrtomb.c: Likewise.
	* wcsmbs/wcsrtombs.c: Likewise.

	* wcsmbs/wcrtomb.c: Compute result correctly for successful call
	with s == NULL.
Diffstat (limited to 'wcsmbs/mbrtowc.c')
-rw-r--r--wcsmbs/mbrtowc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c
index cb0aa32bbc..2aeb67c154 100644
--- a/wcsmbs/mbrtowc.c
+++ b/wcsmbs/mbrtowc.c
@@ -34,6 +34,7 @@ static mbstate_t state;
 size_t
 __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
 {
+  mbstate_t temp_state;
   wchar_t buf[1];
   struct __gconv_step_data data;
   int status;
@@ -57,6 +58,8 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
       data.__outbuf = (char *) buf;
       s = "";
       n = 1;
+      temp_state = *data.__statep;
+      data.__statep = &temp_state;
     }
 
   /* Make sure we use the correct function.  */