History log of /bionic/libc/bionic/locale.cpp
Revision Date Author Comments
f7e3b3e48ab3ffbf7bbce5102ce1739c200093cb 06-Mar-2015 Yabin Cui <yabinc@google.com> Use pthread_once for g_uselocale_key creation.

Bug: 19625804
Change-Id: I57ec4c965067dc0c157c795c1f7217a3ca403286
4a2891d8c8f09a64ea9e1479518b0cc969bd5969 05-Mar-2015 Yabin Cui <yabinc@google.com> Better control of pthread keys used in bionic.

Change-Id: I1e1bc77c0e7879baead6c3417282ce549a1153b5
75ef63d6cf83787233d1c45489c4ec03b0a67d16 21-Nov-2014 Dan Albert <danalbert@google.com> Move some pthread functions to signal.h.

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
b20c24456e43df430ec5626a68e5dc0dc6929344 07-Nov-2014 Elliott Hughes <enh@google.com> Implement all the POSIX _l functions.

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
7e0d0f8572152c47a993e7bc8407690556754bd4 05-Nov-2014 Elliott Hughes <enh@google.com> Fix newlocale with a NULL locale name.

Bug: https://code.google.com/p/android/issues/detail?id=78567
Change-Id: I272dabc12ab186b44a525c7e8ac1846e62334e85
bafee43161b9e38ca6c941eb3646df20ec6da759 14-Aug-2014 Dan Albert <danalbert@google.com> Change name of MB_CUR_MAX implementation function.

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
224ff048efc782bd60047a3ae53eb66941f73125 14-Aug-2014 Dan Albert <danalbert@google.com> Change name of MB_CUR_MAX implementation function.

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
6035e6cc8317600c3100fdf1070890c3e42715a7 30-Jul-2014 Dan Albert <danalbert@google.com> Proper MB_CUR_MAX.

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
(cherry picked from commit 1aec7c1a35b2d03038b194967d5ebdc8e2c24b80)
1aec7c1a35b2d03038b194967d5ebdc8e2c24b80 30-Jul-2014 Dan Albert <danalbert@google.com> Proper MB_CUR_MAX.

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
7149362d33e47d75261dbb66b562713e8312633c 25-Jul-2014 Dan Albert <danalbert@google.com> en_US.UTF-8 is also supported.

Change-Id: Ic35fad3596dc5e24ee8ae35543a274a471f27bb2
(cherry picked from commit 1abb8bd21d64c2bd21258469b688483f821974d5)
1abb8bd21d64c2bd21258469b688483f821974d5 25-Jul-2014 Dan Albert <danalbert@google.com> en_US.UTF-8 is also supported.

Change-Id: Ic35fad3596dc5e24ee8ae35543a274a471f27bb2
1728b2396591853345507a063ed6075dfd251706 14-May-2014 Elliott Hughes <enh@google.com> Switch to g_ for globals.

That's what the Google style guide recommends, and we're starting
to get a mix.

Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
5a0aa3dee247a313f04252cf45608097695d5953 01-May-2014 Elliott Hughes <enh@google.com> Switch to a working UTF-8 mb/wc implementation.

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
2f68866f371faa8ef727fc91e59e1e93326a3949 18-Apr-2014 Elliott Hughes <enh@google.com> Make uselocale(3) claim its pthread key in an ELF constructor.

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
c4936e20a3a8772cc393423037be36091e68acc2 09-Apr-2014 Elliott Hughes <enh@google.com> Flesh out <locale.h>.

This is a trivial implementation that only supports the C/POSIX locale.

Change-Id: Ib11cea4249e1862aca96a8b94d58ea9a418cbe75
5363a45f2b6d4eeb054710d0886bbadea8a15273 08-Apr-2014 Elliott Hughes <enh@google.com> Clean up localeconv(3).

The OpenBSD doesn't support C99, and the extent to which we support
locales is trivial, so just do it ourselves.

Change-Id: If0a06e627ecc593f7b8ea3e9389365782e49b00e