cosmopolitan/third_party/musl/wctrans.c
Justine Tunney 7c83f4abc8
Make improvements
- wcsstr() is now linearly complex
- strstr16() is now linearly complex
- strstr() is now vectorized on aarch64 (10x)
- strstr() now uses KMP on pathological cases
- memmem() is now vectorized on aarch64 (10x)
- memmem() now uses KMP on pathological cases
- Disable shared_ptr::owner_before until fixed
- Make iswlower(), iswupper() consistent with glibc
- Remove figure space from iswspace() implementation
- Include line and paragraph separator in iswcntrl()
- Use Musl wcwidth(), iswalpha(), iswpunct(), towlower(), towupper()
2024-09-01 01:27:47 -07:00

30 lines
628 B
C

#include <wctype.h>
#include <string.h>
#include <locale.h>
wctrans_t wctrans(const char *class)
{
if (!strcmp(class, "toupper")) return (wctrans_t)1;
if (!strcmp(class, "tolower")) return (wctrans_t)2;
return 0;
}
wint_t towctrans(wint_t wc, wctrans_t trans)
{
if (trans == (wctrans_t)1) return towupper(wc);
if (trans == (wctrans_t)2) return towlower(wc);
return wc;
}
wctrans_t __wctrans_l(const char *s, locale_t l)
{
return wctrans(s);
}
wint_t __towctrans_l(wint_t c, wctrans_t t, locale_t l)
{
return towctrans(c, t);
}
__weak_reference(__wctrans_l, wctrans_l);
__weak_reference(__towctrans_l, towctrans_l);