1 --- fgetwc.c.orig 2004-11-25 11:38:34.000000000 -0800
2 +++ fgetwc.c 2005-02-23 17:15:00.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwc.c,v 1.12 2004/07/20 08:27:27 tjr Exp $");
7 +#include "xlocale_private.h"
17 + r = __fgetwc(fp, __current_locale());
24 +fgetwc_l(FILE *fp, locale_t loc)
28 + NORMALIZE_LOCALE(loc);
31 + r = __fgetwc(fp, loc);
36 * Non-MT-safe version.
40 +__fgetwc(FILE *fp, locale_t loc)
44 + struct __xlocale_st_runelocale *xrl = loc->__lc_ctype;
45 + size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict, size_t, mbstate_t * __restrict, locale_t) = xrl->__mbrtowc;
47 if (fp->_r <= 0 && __srefill(fp))
49 - if (MB_CUR_MAX == 1) {
50 + if (xrl->__mb_cur_max == 1) {
51 /* Fast path for single-byte encodings. */
57 - nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate);
58 + nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate, loc);
59 if (nconv == (size_t)-1)
61 else if (nconv == (size_t)-2)