]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/toupper.c.patch
Libc-498.tar.gz
[apple/libc.git] / locale / FreeBSD / toupper.c.patch
CommitLineData
3d9156a7
A
1--- toupper.c.orig 2005-02-17 16:40:25.000000000 -0800
2+++ toupper.c 2005-02-17 16:42:30.000000000 -0800
3@@ -37,20 +37,32 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.11 2004/07/29 06:16:19 tjr Exp $");
9385eb3d 6
3d9156a7 7+#include "xlocale_private.h"
9385eb3d 8+
3d9156a7
A
9 #include <stdio.h>
10 #include <runetype.h>
9385eb3d
A
11
12 __ct_rune_t
3d9156a7
A
13-___toupper(c)
14+___toupper_l(c, loc)
15 __ct_rune_t c;
16+ locale_t loc;
9385eb3d 17 {
3d9156a7
A
18 size_t lim;
19- _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext;
20+ _RuneRange *rr;
21 _RuneEntry *base, *re;
9385eb3d
A
22
23 if (c < 0 || c == EOF)
24 return(c);
25
3d9156a7
A
26+ NORMALIZE_LOCALE(loc);
27+ /*
28+ * the following is not used by toupper(), but can be used by
29+ * toupper_l(). This provides the oppurtunity to optimize toupper()
30+ * when compatibility for Panther and lower is no longer needed
31+ */
32+ if (c < _CACHED_RUNES)
33+ return loc->__lc_ctype->_CurrentRuneLocale.__mapupper[c];
34+ rr = &loc->__lc_ctype->_CurrentRuneLocale.__mapupper_ext;
35 /* Binary search -- see bsearch.c for explanation. */
36 base = rr->__ranges;
37 for (lim = rr->__nranges; lim != 0; lim >>= 1) {
38@@ -65,3 +77,10 @@
9385eb3d
A
39
40 return(c);
41 }
3d9156a7
A
42+
43+__ct_rune_t
44+___toupper(c)
45+ __ct_rune_t c;
46+{
47+ return ___toupper_l(c, __current_locale());
48+}