aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-21 02:46:26 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-21 02:46:26 +0000
commit62ed552b937bc0367df22207d316c14614e94421 (patch)
tree37e896a9a61df77491c91daebd19caa0c1e7dd24 /posix/regex.c
parentUpdate. (diff)
downloadglibc-62ed552b937bc0367df22207d316c14614e94421.tar.gz
glibc-62ed552b937bc0367df22207d316c14614e94421.tar.bz2
glibc-62ed552b937bc0367df22207d316c14614e94421.zip
Update.
2001-08-20 Martin Schwidefsky <schwidefsky@de.ibm.com> * sysdeps/unix/sysv/linux/s390/s390-32/sys/ucontext.h: Revert the change of the gregset_t type. * sysdeps/unix/sysv/linux/s390/s390-64/sys/ucontext.h: Likewise. 2001-08-20 kaz Kojima <kkojima@rr.iij4u.or.jp> * sysdeps/unix/sysv/linux/sh/sysdep.S: Align errno. * posix/regex.c (truncate_wchar): Use wcrtomb not wctomb.
Diffstat (limited to 'posix/regex.c')
-rw-r--r--posix/regex.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/posix/regex.c b/posix/regex.c
index a5c35fecd2..facb833f58 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -4627,9 +4627,16 @@ static unsigned char
truncate_wchar (c)
CHAR_T c;
{
- unsigned char buf[MB_LEN_MAX];
- int retval = wctomb(buf, c);
- return retval > 0 ? buf[0] : (unsigned char)c;
+ unsigned char buf[MB_CUR_MAX];
+ mbstate_t state;
+ int retval;
+ memset (&state, '\0', sizeof (state));
+# ifdef _LIBC
+ retval = __wcrtomb (buf, c, &state);
+# else
+ retval = wcrtomb (buf, c, &state);
+# endif
+ return retval > 0 ? buf[0] : (unsigned char) c;
}
#endif /* WCHAR */