aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/locale.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use pthread_once for g_uselocale_key creation.Yabin Cui2015-03-051-13/+18
| | | | | Bug: 19625804 Change-Id: I57ec4c965067dc0c157c795c1f7217a3ca403286
* Better control of pthread keys used in bionic.Yabin Cui2015-03-041-4/+2
| | | | Change-Id: I1e1bc77c0e7879baead6c3417282ce549a1153b5
* Move some pthread functions to signal.h.Dan Albert2014-11-211-0/+1
| | | | | | | | | | | | | POSIX specifies that pthread_kill(3) and pthread_sigmask(3) are supposed to live in signal.h rather than pthread.h. Since signal.h now needs pthread_t and pthread_attr_t, I've moved those defintions into include/machine/pthread_types.h to keep the namespace clean. I also sorted some includes. The combination of these two things seems to have exploded into a cascade of missing includes, so this patch also cleans up all those. Change-Id: Icfa92a39432fe83f542a797e5a113289d7e4ad0c
* Implement all the POSIX _l functions.Elliott Hughes2014-11-061-0/+48
| | | | | | | | Strictly speaking, this only implements the _l variants of the functions we actually have. We're still missing nl_langinfo_l, for example, but we don't have nl_langinfo either. Change-Id: Ie711c7b04e7b9100932a13f5a5d5b28847eb4c12
* Fix newlocale with a NULL locale name.Elliott Hughes2014-11-041-2/+2
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=78567 Change-Id: I272dabc12ab186b44a525c7e8ac1846e62334e85
* Change name of MB_CUR_MAX implementation function.Dan Albert2014-08-141-1/+1
| | | | | | | | Glibc calls theirs __ctype_get_mb_cur_max. Make ours match to cut down on differences between bionic and glibc. Bug: 11156955 Change-Id: Ib7231f01aa9676dff30aea0af25d597bfe07bc73
* Proper MB_CUR_MAX.Dan Albert2014-07-301-13/+29
| | | | | | | | | | Previously this was hard coded to 4. This is only the case for UTF-8 locales. As a side effect, this properly reports C.UTF-8 as the default locale instead of C. Change-Id: I7c73cc8fe6ffac61d211cd5f75287e36de06f4fc
* en_US.UTF-8 is also supported.Dan Albert2014-07-251-1/+3
| | | | Change-Id: Ic35fad3596dc5e24ee8ae35543a274a471f27bb2
* Switch to g_ for globals.Elliott Hughes2014-05-141-33/+33
| | | | | | | That's what the Google style guide recommends, and we're starting to get a mix. Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
* Switch to a working UTF-8 mb/wc implementation.Elliott Hughes2014-05-011-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Although glibc gets by with an 8-byte mbstate_t, OpenBSD uses 12 bytes (of the 128 bytes it reserves!). We can actually implement UTF-8 encoding/decoding with a 0-byte mbstate_t which means we can make things work on LP32 too, as long as we accept the limitation that the caller needs to present us with a complete sequence before we'll process it. Our behavior is fine when going from characters to bytes; we just update the source wchar_t** to say how far through the input we got. I'll come back and use the 4 bytes we do have to cope with byte sequences split across multiple input buffers. The fact that we don't support UTF-8 sequences longer than 4 bytes plus the fact that the first byte of a UTF-8 sequence encodes the length means we shouldn't need the other fields OpenBSD used (at the cost of some recomputation in cases where a sequence is split across buffers). This patch also makes the minimal changes necessary to setlocale(3) to make us behave like glibc when an app requests UTF-8. (The difference being that our "C" locale is the same as our "C.UTF-8" locale.) Change-Id: Ied327a8c4643744b3611bf6bb005a9b389ba4c2f
* Make uselocale(3) claim its pthread key in an ELF constructor.Elliott Hughes2014-04-181-7/+4
| | | | | | | | | | pthread_once is nice for decoupling, but it makes resource availability less predictable, which is a bad thing. This fixes a test failure if uselocale(3) is called before pthread.pthread_key_create_lots runs. Change-Id: Ie2634f986a50e7965582d4bd6e5aaf48cf0d55c8
* Flesh out <locale.h>.Elliott Hughes2014-04-081-31/+113
| | | | | | This is a trivial implementation that only supports the C/POSIX locale. Change-Id: Ib11cea4249e1862aca96a8b94d58ea9a418cbe75
* Clean up localeconv(3).Elliott Hughes2014-04-081-0/+74
The OpenBSD doesn't support C99, and the extent to which we support locales is trivial, so just do it ourselves. Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e