there's portable public API for that: MB_CUR_MAX in <stdlib.h>. On Sun, Feb 15, 2015 at 4:49 PM, Kevin Cernekee <cerne...@google.com> wrote: > * lib/localename.c: Android API level >= 21 supports two hardcoded > locales: C (POSIX) and C.UTF-8. Distinguish them by checking > the internal __locale_t struct. > --- > ChangeLog | 5 +++++ > lib/localename.c | 6 ++++++ > 2 files changed, 11 insertions(+) > > diff --git a/ChangeLog b/ChangeLog > index 9b84dac..58fd8ab 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -63,6 +63,11 @@ > they will be able to create a file descriptor numbered > (getdtablesize()-1), and will fail if rlim_max > rlim_cur. > > + localename: Implement gl_locale_name_thread_unsafe() for Android > + * lib/localename.c: Android API level >= 21 supports two hardcoded > + locales: C (POSIX) and C.UTF-8. Distinguish them by checking > + the internal __locale_t struct. > + > 2015-02-11 Pádraig Brady <p...@draigbrady.com> > > tests: avoid recent -Werror=unused-variable regression in test-locale > diff --git a/lib/localename.c b/lib/localename.c > index c6f326e..7cc4570 100644 > --- a/lib/localename.c > +++ b/lib/localename.c > @@ -2730,6 +2730,12 @@ gl_locale_name_thread_unsafe (int category, const char > *categoryname) > # elif defined __sun > /* Solaris >= 12. */ > return getlocalename_l (category, thread_locale); > +# elif defined __ANDROID__ > + struct { > + size_t mb_cur_max; > + } *__locale = (void *)thread_locale; > + > + return __locale->mb_cur_max == 4 ? "C.UTF-8" : "C"; > # endif > } > } > -- > 1.9.1 >
-- Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Java i18n/JNI/NIO, or bionic questions? Mail me/drop by/add me as a reviewer.