X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/locale/FreeBSD/toupper.c diff --git a/locale/FreeBSD/toupper.c b/locale/FreeBSD/toupper.c index e160b39..d02ddd6 100644 --- a/locale/FreeBSD/toupper.c +++ b/locale/FreeBSD/toupper.c @@ -32,22 +32,34 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); + +#include "xlocale_private.h" #include #include #include __ct_rune_t -___toupper(c) +___toupper_l(c, loc) __ct_rune_t c; + locale_t loc; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext; + _RuneRange *rr; _RuneEntry *base, *re; if (c < 0 || c == EOF) return(c); + NORMALIZE_LOCALE(loc); + /* + * the following is not used by toupper(), but can be used by + * toupper_l(). This provides the oppurtunity to optimize toupper() + * when compatibility for Panther and lower is no longer needed + */ + if (c < _CACHED_RUNES) + return loc->__lc_ctype->_CurrentRuneLocale.__mapupper[c]; + rr = &loc->__lc_ctype->_CurrentRuneLocale.__mapupper_ext; /* Binary search -- see bsearch.c for explanation. */ base = rr->__ranges; for (lim = rr->__nranges; lim != 0; lim >>= 1) { @@ -62,3 +74,10 @@ ___toupper(c) return(c); } + +__ct_rune_t +___toupper(c) + __ct_rune_t c; +{ + return ___toupper_l(c, __current_locale()); +}