bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] localename: Implement gl_locale_name_thread_unsafe() for And


From: Kevin Cernekee
Subject: [PATCH 3/3] localename: Implement gl_locale_name_thread_unsafe() for Android
Date: Sun, 15 Feb 2015 16:49:07 -0800

* 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  <address@hidden>
 
        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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]