---- 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 <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.11 2004/07/29 06:16:19 tjr Exp $");
- #include <stdio.h>
- #include <rune.h>
-+#include <stdlib.h>
-+
-+__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 <stdio.h>
+ #include <runetype.h>
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());
++}