int toupper_l(int c, struct __locale_t *locale) { #if defined (_MB_EXTENDED_CHARSETS_ISO) \ || defined (_MB_EXTENDED_CHARSETS_WINDOWS) if ((unsigned char) c <= 0x7f) return islower_l (c, locale) ? c - 'a' + 'A' : c; else if (c != EOF && __locale_mb_cur_max_l (locale) == 1 && islower_l (c, locale)) { char s[MB_LEN_MAX] = { c, '\0' }; wchar_t wc; mbstate_t state; memset (&state, 0, sizeof state); if (locale->mbtowc (_REENT, &wc, s, 1, &state) >= 0 && locale->wctomb (_REENT, s, (wchar_t) towupper_l ((wint_t) wc, locale), &state) == 1) c = (unsigned char) s[0]; } return c; #else return islower_l(c, locale) ? c - 'a' + 'A' : c; #endif }
static int pg_wc_islower(pg_wchar c) { switch (pg_regex_strategy) { case PG_REGEX_LOCALE_C: return (c <= (pg_wchar) 127 && (pg_char_properties[c] & PG_ISLOWER)); case PG_REGEX_LOCALE_WIDE: #ifdef USE_WIDE_UPPER_LOWER if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF) return iswlower((wint_t) c); #endif /* FALL THRU */ case PG_REGEX_LOCALE_1BYTE: return (c <= (pg_wchar) UCHAR_MAX && islower((unsigned char) c)); case PG_REGEX_LOCALE_WIDE_L: #if defined(HAVE_LOCALE_T) && defined(USE_WIDE_UPPER_LOWER) if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF) return iswlower_l((wint_t) c, pg_regex_locale); #endif /* FALL THRU */ case PG_REGEX_LOCALE_1BYTE_L: #ifdef HAVE_LOCALE_T return (c <= (pg_wchar) UCHAR_MAX && islower_l((unsigned char) c, pg_regex_locale)); #endif break; } return 0; /* can't get here, but keep compiler quiet */ }