X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/3d9156a7a519a5e3aa1b92e9d9d4b991f1aed7ff..HEAD:/locale/FreeBSD/tolower.c diff --git a/locale/FreeBSD/tolower.c b/locale/FreeBSD/tolower.c index 24694e7..298b321 100644 --- a/locale/FreeBSD/tolower.c +++ b/locale/FreeBSD/tolower.c @@ -13,10 +13,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -35,22 +31,35 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.11 2004/07/29 06:16:19 tjr Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); + +#include "xlocale_private.h" +#include #include #include __ct_rune_t -___tolower(c) +___tolower_l(c, loc) __ct_rune_t c; + locale_t loc; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->__maplower_ext; + _RuneRange *rr; _RuneEntry *base, *re; if (c < 0 || c == EOF) return(c); + NORMALIZE_LOCALE(loc); + /* + * the following is not used by tolower(), but can be used by + * tolower_l(). This provides the oppurtunity to optimize tolower() + * when compatibility for Panther and lower is no longer needed + */ + if (c < _CACHED_RUNES) + return loc->__lc_ctype->_CurrentRuneLocale.__maplower[c]; + rr = &loc->__lc_ctype->_CurrentRuneLocale.__maplower_ext; /* Binary search -- see bsearch.c for explanation. */ base = rr->__ranges; for (lim = rr->__nranges; lim != 0; lim >>= 1) { @@ -65,3 +74,10 @@ ___tolower(c) return(c); } + +__ct_rune_t +___tolower(c) + __ct_rune_t c; +{ + return ___tolower_l(c, __current_locale()); +}