diff options
Diffstat (limited to 'lib/libc/locale/toupper.c')
-rw-r--r-- | lib/libc/locale/toupper.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c index 4870e8e..d3a4fa3 100644 --- a/lib/libc/locale/toupper.c +++ b/lib/libc/locale/toupper.c @@ -5,6 +5,11 @@ * This code is derived from software contributed to Berkeley by * Paul Borman at Krystal Technologies. * + * Copyright (c) 2011 The FreeBSD Foundation + * All rights reserved. + * Portions of this software were developed by David Chisnall + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -36,13 +41,17 @@ __FBSDID("$FreeBSD$"); #include <ctype.h> #include <stdio.h> #include <runetype.h> +#include <wchar.h> +#include "mblocal.h" __ct_rune_t -___toupper(c) +___toupper_l(c, l) __ct_rune_t c; + locale_t l; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext; + FIX_LOCALE(l); + _RuneRange *rr = &XLOCALE_CTYPE(l)->runes->__maplower_ext; _RuneEntry *base, *re; if (c < 0 || c == EOF) @@ -53,7 +62,9 @@ ___toupper(c) for (lim = rr->__nranges; lim != 0; lim >>= 1) { re = base + (lim >> 1); if (re->__min <= c && c <= re->__max) + { return (re->__map + c - re->__min); + } else if (c > re->__max) { base = re + 1; lim--; @@ -62,3 +73,9 @@ ___toupper(c) return(c); } +__ct_rune_t +___toupper(c) + __ct_rune_t c; +{ + return ___toupper_l(c, __get_locale()); +} |