Deleted Added
full compact
toupper.c (129065) toupper.c (130961)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Paul Borman at Krystal Technologies.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Paul Borman at Krystal Technologies.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: head/lib/libc/locale/toupper.c 129065 2004-05-09 13:04:49Z tjr $");
38__FBSDID("$FreeBSD: head/lib/libc/locale/toupper.c 130961 2004-06-23 07:01:44Z tjr $");
39
40#include <stdio.h>
41#include <rune.h>
42
43__ct_rune_t
44___toupper(c)
45 __ct_rune_t c;
46{
47 size_t lim;
39
40#include <stdio.h>
41#include <rune.h>
42
43__ct_rune_t
44___toupper(c)
45 __ct_rune_t c;
46{
47 size_t lim;
48 _RuneRange *rr = &_CurrentRuneLocale->mapupper_ext;
48 _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext;
49 _RuneEntry *base, *re;
50
51 if (c < 0 || c == EOF)
52 return(c);
53
54 /* Binary search -- see bsearch.c for explanation. */
49 _RuneEntry *base, *re;
50
51 if (c < 0 || c == EOF)
52 return(c);
53
54 /* Binary search -- see bsearch.c for explanation. */
55 base = rr->ranges;
56 for (lim = rr->nranges; lim != 0; lim >>= 1) {
55 base = rr->__ranges;
56 for (lim = rr->__nranges; lim != 0; lim >>= 1) {
57 re = base + (lim >> 1);
57 re = base + (lim >> 1);
58 if (re->min <= c && c <= re->max)
59 return (re->map + c - re->min);
60 else if (c > re->max) {
58 if (re->__min <= c && c <= re->__max)
59 return (re->__map + c - re->__min);
60 else if (c > re->__max) {
61 base = re + 1;
62 lim--;
63 }
64 }
65
66 return(c);
67}
61 base = re + 1;
62 lim--;
63 }
64 }
65
66 return(c);
67}