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