Call __mbrtowc() and __wcrtomb() directly instead of taking detours
through mbrtowc() and wcrtomb().
This commit is contained in:
parent
efd0e5f49e
commit
f9ceea9bf1
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "un-namespace.h"
|
||||
#include "libc_private.h"
|
||||
#include "local.h"
|
||||
#include "mblocal.h"
|
||||
|
||||
/*
|
||||
* MT-safe version.
|
||||
@ -70,7 +71,7 @@ __fgetwc(FILE *fp)
|
||||
return (wc);
|
||||
}
|
||||
do {
|
||||
nconv = mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate);
|
||||
nconv = __mbrtowc(&wc, fp->_p, fp->_r, &fp->_extra->mbstate);
|
||||
if (nconv == (size_t)-1)
|
||||
break;
|
||||
else if (nconv == (size_t)-2)
|
||||
|
@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "un-namespace.h"
|
||||
#include "libc_private.h"
|
||||
#include "local.h"
|
||||
#include "mblocal.h"
|
||||
|
||||
/*
|
||||
* Non-MT-safe version.
|
||||
@ -55,7 +56,7 @@ __fputwc(wchar_t wc, FILE *fp)
|
||||
*buf = (unsigned char)wc;
|
||||
len = 1;
|
||||
} else {
|
||||
if ((len = wcrtomb(buf, wc, &fp->_extra->mbstate)) ==
|
||||
if ((len = __wcrtomb(buf, wc, &fp->_extra->mbstate)) ==
|
||||
(size_t)-1) {
|
||||
fp->_flags |= __SERR;
|
||||
return (WEOF);
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include "un-namespace.h"
|
||||
#include "libc_private.h"
|
||||
#include "local.h"
|
||||
#include "mblocal.h"
|
||||
|
||||
/*
|
||||
* Non-MT-safe version.
|
||||
@ -47,7 +48,7 @@ __ungetwc(wint_t wc, FILE *fp)
|
||||
|
||||
if (wc == WEOF)
|
||||
return (WEOF);
|
||||
if ((len = wcrtomb(buf, wc, &fp->_extra->mbstate)) == (size_t)-1) {
|
||||
if ((len = __wcrtomb(buf, wc, &fp->_extra->mbstate)) == (size_t)-1) {
|
||||
fp->_flags |= __SERR;
|
||||
return (WEOF);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user