X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..8660941ad630afd60a9b2fc76ce5e8fce4de00d7:/locale/FreeBSD/runetype.c.patch diff --git a/locale/FreeBSD/runetype.c.patch b/locale/FreeBSD/runetype.c.patch index edccc90..d9a6109 100644 --- a/locale/FreeBSD/runetype.c.patch +++ b/locale/FreeBSD/runetype.c.patch @@ -1,53 +1,41 @@ ---- runetype.c.orig Tue May 20 15:21:44 2003 -+++ runetype.c Tue Jun 17 17:50:43 2003 -@@ -39,27 +39,39 @@ +--- runetype.c.orig 2004-11-25 11:38:19.000000000 -0800 ++++ runetype.c 2005-02-16 22:43:53.000000000 -0800 +@@ -37,20 +37,25 @@ + #include + __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.11 2004/07/29 06:16:19 tjr Exp $"); - #include - #include -+#include -+ -+__private_extern__ int -+__compRuneEntry(const void *rune, const void *range) -+{ -+ __ct_rune_t c = *(__ct_rune_t *)rune; -+ _RuneEntry *re = (_RuneEntry *)range; ++#include "xlocale_private.h" + -+ if (c < re->min) -+ return(-1); -+ if (c > re->max) -+ return(1); -+ return(0); -+} + #include + #include unsigned long - ___runetype(c) +-___runetype(c) ++___runetype_l(c, loc) __ct_rune_t c; ++ locale_t loc; { -- int x; - _RuneRange *rr = &_CurrentRuneLocale->runetype_ext; -- _RuneEntry *re = rr->ranges; -+ _RuneEntry *re; + size_t lim; +- _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext; ++ _RuneRange *rr; + _RuneEntry *base, *re; if (c < 0 || c == EOF) return(0L); -- for (x = 0; x < rr->nranges; ++x, ++re) { -- if (c < re->min) -- return(0L); -- if (c <= re->max) { -- if (re->types) -- return(re->types[c - re->min]); -- else -- return(re->map); -- } -+ re = (_RuneEntry *)bsearch(&c, rr->ranges, rr->nranges, -+ sizeof(_RuneEntry), __compRuneEntry); -+ -+ if (re) { -+ if (re->types) -+ return(re->types[c - re->min]); -+ else -+ return(re->map); - } ++ NORMALIZE_LOCALE(loc); ++ rr = &loc->__lc_ctype->_CurrentRuneLocale.__runetype_ext; + /* Binary search -- see bsearch.c for explanation. */ + base = rr->__ranges; + for (lim = rr->__nranges; lim != 0; lim >>= 1) { +@@ -68,3 +73,10 @@ return(0L); + } ++ ++unsigned long ++___runetype(c) ++ __ct_rune_t c; ++{ ++ return ___runetype_l(c, __current_locale()); ++}