diff options
author | Yuri Pankov <yuripv@FreeBSD.org> | 2018-11-09 03:32:53 +0000 |
---|---|---|
committer | Yuri Pankov <yuripv@FreeBSD.org> | 2018-11-09 03:32:53 +0000 |
commit | 9eb7d595e1fdf04945fdaf3634cfd1354493ecf0 (patch) | |
tree | e1f1d436c5d9b7d4c1d882b3799d41eed011f67d /lib/libc/locale/mbrtowc.c | |
parent | e1e300b67102a8e6b826200d7fc145ceacab6e93 (diff) |
Reset persistent mbstates when rune locale encoding changes.
This was shown to be a problem by side effect of now-enabled test case,
which was going through C, en_US.UTF-8, ja_JP.SJIS, and ja_JP.eucJP,
and failing eventually as data in mbrtowc's mbstate, that was
perfectly correct for en_US.UTF-8 was treated as incorrect for
ja_JP.SJIS, failing the entire test case.
This makes the persistent mbstates to be per ctype-component,
and not per-locale so we could easily reset the mbstates when
only LC_CTYPE is changed.
Reviewed by: bapt, pfg
Approved by: kib (mentor, implicit)
Differential Revision: https://reviews.freebsd.org/D17796
Notes
Notes:
svn path=/head/; revision=340276
Diffstat (limited to 'lib/libc/locale/mbrtowc.c')
-rw-r--r-- | lib/libc/locale/mbrtowc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/locale/mbrtowc.c b/lib/libc/locale/mbrtowc.c index 4171886c8efa..7585ef16bca2 100644 --- a/lib/libc/locale/mbrtowc.c +++ b/lib/libc/locale/mbrtowc.c @@ -43,7 +43,7 @@ mbrtowc_l(wchar_t * __restrict pwc, const char * __restrict s, { FIX_LOCALE(locale); if (ps == NULL) - ps = &locale->mbrtowc; + ps = &(XLOCALE_CTYPE(locale)->mbrtowc); return (XLOCALE_CTYPE(locale)->__mbrtowc(pwc, s, n, ps)); } |