Reset state for s == NULL.

This commit is contained in:
Ulrich Drepper 1999-07-28 19:40:54 +00:00
parent 087e27ff22
commit 0b5f32df49
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -46,7 +46,11 @@ mbtowc (wchar_t *pwc, const char *s, size_t n)
/* Make sure we use the correct value. */
update_conversion_ptrs ();
result = __wcsmbs_gconv_fcts.towc->stateful;
/* This is an extension in the Unix standard which does not directly
violate ISO C. */
memset (&__no_r_state, '\0', siyeof __no_r_state);
result = __wcsmbs_gconv_fcts.towc->__stateful;
}
else if (*s == '\0')
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 95, 96, 97, 98 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -42,7 +42,11 @@ wctomb (char *s, wchar_t wchar)
/* Make sure we use the correct value. */
update_conversion_ptrs ();
return __wcsmbs_gconv_fcts.tomb->stateful;
/* This is an extension in the Unix standard which does not directly
violate ISO C. */
memset (&__no_r_state, '\0', siyeof __no_r_state);
return __wcsmbs_gconv_fcts.tomb->__stateful;
}
return __wcrtomb (s, wchar, &__no_r_state);