both patches attached this time...

>From 4be700794df2e2c6d745f464ff960dda2f6a448e Mon Sep 17 00:00:00 2001
From: Alexander Pyhalov <[email protected]>
Date: Thu, 29 Jan 2015 16:35:24 +0000
Subject: [PATCH 1/2] locale: fix tests on illumos

* tests/test-locale.c: LC_GLOBAL_LOCALE is a function call on illumos,
so move from global scope to main().
---
 ChangeLog           |  6 ++++++
 tests/test-locale.c | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a57bdd0..51287ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-29  Alexander Pyhalov  <[email protected]>
+
+	locale: fix tests on illumos
+	* tests/test-locale.c: LC_GLOBAL_LOCALE is a function call on illumos,
+	so move from global scope to main().
+
 2015-01-24  Daiki Ueno  <[email protected]>
 
 	unictype: avoid undefined left-shift behavior
diff --git a/tests/test-locale.c b/tests/test-locale.c
index 492efb4..ad1b679 100644
--- a/tests/test-locale.c
+++ b/tests/test-locale.c
@@ -33,11 +33,6 @@ int a[] =
     LC_TIME
   };
 
-#if HAVE_NEWLOCALE
-/* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined.  */
-locale_t b = LC_GLOBAL_LOCALE;
-#endif
-
 /* Check that the 'struct lconv' type is defined.  */
 struct lconv l;
 int ls;
@@ -49,6 +44,11 @@ verify (sizeof NULL == sizeof (void *));
 int
 main ()
 {
+#if HAVE_NEWLOCALE
+  /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined.  */
+  locale_t b = LC_GLOBAL_LOCALE;
+#endif
+
   /* Check that 'struct lconv' has the ISO C and POSIX specified members.  */
   ls += sizeof (*l.decimal_point);
   ls += sizeof (*l.thousands_sep);
-- 
2.1.0


>From 2e5e0ec49357294ef9c453f786682c1e59dfb402 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 29 Jan 2015 16:44:48 +0000
Subject: [PATCH 2/2] localename: support Solaris 12 and Illumos

* lib/localename.c (gl_locale_name_thread_unsafe): call
getlocalename_l() on newer __sun platforms.
Reported by Alexander Pyhalov.
Fix suggested by Rich Burridge.
---
 ChangeLog        | 8 ++++++++
 lib/localename.c | 9 ++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 51287ba..9740ff5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-29  Pádraig Brady  <[email protected]>
+
+	localename: support Solaris 12 and Illumos
+	* lib/localename.c (gl_locale_name_thread_unsafe): call
+	getlocalename_l() on newer __sun platforms.
+	Reported by Alexander Pyhalov.
+	Fix suggested by Rich Burridge.
+
 2015-01-29  Alexander Pyhalov  <[email protected]>
 
 	locale: fix tests on illumos
diff --git a/lib/localename.c b/lib/localename.c
index 815171c..c6f326e 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -42,6 +42,10 @@
 # if !defined IN_LIBINTL
 #  include "glthread/lock.h"
 # endif
+# if defined __sun
+/* Solaris >= 12.  */
+extern char * getlocalename_l(int, locale_t);
+# endif
 #endif
 
 #if HAVE_CFLOCALECOPYCURRENT || HAVE_CFPREFERENCESCOPYAPPVALUE
@@ -2584,7 +2588,7 @@ get_lcid (const char *locale_name)
 #endif
 
 
-#if HAVE_USELOCALE /* glibc or Mac OS X */
+#if HAVE_USELOCALE /* glibc, Solaris >= 12 or Mac OS X */
 
 /* Simple hash set of strings.  We don't want to drag in lots of hash table
    code here.  */
@@ -2723,6 +2727,9 @@ gl_locale_name_thread_unsafe (int category, const char *categoryname)
             return "";
           }
         return querylocale (mask, thread_locale);
+#  elif defined __sun
+        /* Solaris >= 12.  */
+        return getlocalename_l (category, thread_locale);
 #  endif
       }
   }
-- 
2.1.0

Reply via email to