From cee395a0340092c61a4024a2021842e9d43bc544 Mon Sep 17 00:00:00 2001
From: Pavel Chupin <pavel.v.chupin@intel.com>
Date: Sun, 27 Apr 2014 22:23:39 -0700
Subject: [PATCH 09/12] Fix locale stuff for LP64

---
 include/__locale                       | 13 +++++++++++++
 src/support/android/locale_android.cpp | 14 ++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/include/__locale b/include/__locale
index c793cfe..d078810 100644
--- a/include/__locale
+++ b/include/__locale
@@ -376,6 +376,19 @@ public:
     static const mask xdigit = _ISXDIGIT;
     static const mask blank  = _ISBLANK;
 #elif defined(__ANDROID__)
+# if !defined(_U)
+#   if !defined(_CTYPE_U)
+#    error Bionic header ctype.h does not define either _U nor _CTYPE_U
+#   endif
+#   define _U _CTYPE_U
+#   define _L _CTYPE_L
+#   define _N _CTYPE_N
+#   define _S _CTYPE_S
+#   define _P _CTYPE_P
+#   define _C _CTYPE_C
+#   define _X _CTYPE_X
+#   define _B _CTYPE_B
+# endif
     typedef unsigned short mask;
     static const mask space  = _S;
     static const mask print  = _P | _U | _L | _N | _B;
diff --git a/src/support/android/locale_android.cpp b/src/support/android/locale_android.cpp
index 7193028..9716458 100644
--- a/src/support/android/locale_android.cpp
+++ b/src/support/android/locale_android.cpp
@@ -43,6 +43,20 @@
 //
 extern "C" const unsigned short* const _ctype_android;
 
+#if !defined(_U)
+#  if !defined(_CTYPE_U)
+#   error Bionic header ctype.h does not define either _U nor _CTYPE_U
+#  endif
+#  define _U _CTYPE_U
+#  define _L _CTYPE_L
+#  define _N _CTYPE_N
+#  define _S _CTYPE_S
+#  define _P _CTYPE_P
+#  define _C _CTYPE_C
+#  define _X _CTYPE_X
+#  define _B _CTYPE_B
+#endif
+
 static const unsigned short ctype_android_tab[256+128] = {
        /* -128..-1 */
         _C,     _C,           _C,     _C,     _C,     _C,     _C,     _C, /* 80 */
-- 
1.9.1.423.g4596e3a