diff options
author | tjr <tjr@FreeBSD.org> | 2004-05-12 14:26:54 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2004-05-12 14:26:54 +0000 |
commit | 5ad27cd64f958bb973cd2fe0e8c9169e69168e05 (patch) | |
tree | a4b3d33fdc70e217fd81cdb660a70bd2e6e3af51 /lib | |
parent | e3f042f4aff04f73fd65f7788919c29bd71cfd1e (diff) | |
download | FreeBSD-src-5ad27cd64f958bb973cd2fe0e8c9169e69168e05.zip FreeBSD-src-5ad27cd64f958bb973cd2fe0e8c9169e69168e05.tar.gz |
Reduce overhead by calling internal versions of the multibyte conversion
functions directly wherever possible.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/btowc.c | 3 | ||||
-rw-r--r-- | lib/libc/locale/mblen.c | 3 | ||||
-rw-r--r-- | lib/libc/locale/mbrlen.c | 3 | ||||
-rw-r--r-- | lib/libc/locale/mbsrtowcs.c | 5 | ||||
-rw-r--r-- | lib/libc/locale/mbtowc.c | 3 | ||||
-rw-r--r-- | lib/libc/locale/wcsrtombs.c | 7 | ||||
-rw-r--r-- | lib/libc/locale/wctob.c | 3 | ||||
-rw-r--r-- | lib/libc/locale/wctomb.c | 3 |
8 files changed, 19 insertions, 11 deletions
diff --git a/lib/libc/locale/btowc.c b/lib/libc/locale/btowc.c index 34439b8..2c4d493 100644 --- a/lib/libc/locale/btowc.c +++ b/lib/libc/locale/btowc.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include <stdio.h> #include <wchar.h> +#include "mblocal.h" wint_t btowc(int c) @@ -46,7 +47,7 @@ btowc(int c) * counts. */ cc = (char)c; - if (mbrtowc(&wc, &cc, 1, &mbs) > 1) + if (__mbrtowc(&wc, &cc, 1, &mbs) > 1) return (WEOF); return (wc); } diff --git a/lib/libc/locale/mblen.c b/lib/libc/locale/mblen.c index 8db5335..8486e71 100644 --- a/lib/libc/locale/mblen.c +++ b/lib/libc/locale/mblen.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <limits.h> #include <stdlib.h> #include <wchar.h> +#include "mblocal.h" int mblen(const char *s, size_t n) @@ -44,7 +45,7 @@ mblen(const char *s, size_t n) mbs = initial; return (0); } - rval = mbrtowc(NULL, s, n, &mbs); + rval = __mbrtowc(NULL, s, n, &mbs); if (rval == (size_t)-1 || rval == (size_t)-2) return (-1); if (rval > INT_MAX) { diff --git a/lib/libc/locale/mbrlen.c b/lib/libc/locale/mbrlen.c index edad289..b4c3a04 100644 --- a/lib/libc/locale/mbrlen.c +++ b/lib/libc/locale/mbrlen.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include <wchar.h> +#include "mblocal.h" size_t mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) @@ -36,5 +37,5 @@ mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps) if (ps == NULL) ps = &mbs; - return (mbrtowc(NULL, s, n, ps)); + return (__mbrtowc(NULL, s, n, ps)); } diff --git a/lib/libc/locale/mbsrtowcs.c b/lib/libc/locale/mbsrtowcs.c index 8b3de2f..6a0f3e8 100644 --- a/lib/libc/locale/mbsrtowcs.c +++ b/lib/libc/locale/mbsrtowcs.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <limits.h> #include <stdlib.h> #include <wchar.h> +#include "mblocal.h" size_t mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len, @@ -49,7 +50,7 @@ mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len, ps = &mbs; if (dst == NULL) { for (;;) { - if ((nb = (int)mbrtowc(&wc, s, MB_CUR_MAX, ps)) < 0) + if ((nb = (int)__mbrtowc(&wc, s, MB_CUR_MAX, ps)) < 0) /* Invalid sequence - mbrtowc() sets errno. */ return ((size_t)-1); else if (nb == 0) @@ -61,7 +62,7 @@ mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len, } while (len-- > 0) { - if ((nb = (int)mbrtowc(dst, s, MB_CUR_MAX, ps)) < 0) { + if ((nb = (int)__mbrtowc(dst, s, MB_CUR_MAX, ps)) < 0) { *src = s; return ((size_t)-1); } else if (nb == 0) { diff --git a/lib/libc/locale/mbtowc.c b/lib/libc/locale/mbtowc.c index 465f45a..994d243 100644 --- a/lib/libc/locale/mbtowc.c +++ b/lib/libc/locale/mbtowc.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <wchar.h> +#include "mblocal.h" int mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n) @@ -45,7 +46,7 @@ mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n) mbs = initial; return (0); } - rval = mbrtowc(pwc, s, n, &mbs); + rval = __mbrtowc(pwc, s, n, &mbs); if (rval == (size_t)-1 || rval == (size_t)-2) return (-1); if (rval > INT_MAX) { diff --git a/lib/libc/locale/wcsrtombs.c b/lib/libc/locale/wcsrtombs.c index 4fa5ff8..dfc541f 100644 --- a/lib/libc/locale/wcsrtombs.c +++ b/lib/libc/locale/wcsrtombs.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <wchar.h> +#include "mblocal.h" size_t wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len, @@ -50,7 +51,7 @@ wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len, ps = &mbs; if (dst == NULL) { for (;;) { - if ((nb = (int)wcrtomb(buf, *s, ps)) < 0) + if ((nb = (int)__wcrtomb(buf, *s, ps)) < 0) /* Invalid character - wcrtomb() sets errno. */ return ((size_t)-1); else if (*s == L'\0') @@ -64,7 +65,7 @@ wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len, while (len > 0) { if (len > (size_t)MB_CUR_MAX) { /* Enough space to translate in-place. */ - if ((nb = (int)wcrtomb(dst, *s, ps)) < 0) { + if ((nb = (int)__wcrtomb(dst, *s, ps)) < 0) { *src = s; return ((size_t)-1); } @@ -77,7 +78,7 @@ wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len, * character is too long for the buffer. */ mbsbak = *ps; - if ((nb = (int)wcrtomb(buf, *s, ps)) < 0) { + if ((nb = (int)__wcrtomb(buf, *s, ps)) < 0) { *src = s; return ((size_t)-1); } diff --git a/lib/libc/locale/wctob.c b/lib/libc/locale/wctob.c index 4f4d295..cb39adc 100644 --- a/lib/libc/locale/wctob.c +++ b/lib/libc/locale/wctob.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include <limits.h> #include <stdio.h> #include <wchar.h> +#include "mblocal.h" int wctob(wint_t c) @@ -38,7 +39,7 @@ wctob(wint_t c) mbstate_t mbs = initial; char buf[MB_LEN_MAX]; - if (c == WEOF || wcrtomb(buf, c, &mbs) != 1) + if (c == WEOF || __wcrtomb(buf, c, &mbs) != 1) return (EOF); return ((unsigned char)*buf); } diff --git a/lib/libc/locale/wctomb.c b/lib/libc/locale/wctomb.c index 9e6f183..6616a66 100644 --- a/lib/libc/locale/wctomb.c +++ b/lib/libc/locale/wctomb.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <string.h> #include <wchar.h> +#include "mblocal.h" int wctomb(char *s, wchar_t wchar) @@ -45,7 +46,7 @@ wctomb(char *s, wchar_t wchar) mbs = initial; return (0); } - if ((rval = wcrtomb(s, wchar, &mbs)) == (size_t)-1) + if ((rval = __wcrtomb(s, wchar, &mbs)) == (size_t)-1) return (-1); if (rval > INT_MAX) { errno = ERANGE; |