]> Savannah Git Hosting - gnulib.git/commitdiff
getlocalename_l-unsafe: Improve support for Solaris 11 OpenIndiana. master
authorBruno Haible <bruno@clisp.org>
Sun, 4 May 2025 16:25:53 +0000 (18:25 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 May 2025 16:25:53 +0000 (18:25 +0200)
Suggested by Andy Fiddaman <illumos@fiddaman.net> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00018.html>.

* lib/getlocalename_l-unsafe.c (getlocalename_l_unsafe): On Solaris, use
the system's getlocalename_l() function if available.

ChangeLog
lib/getlocalename_l-unsafe.c

index e43a5efbe73f5802475971c47e2c0f06700d2395..6a0b2a1361f2c4bfde5cf6d3713e8c4070613edd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-05-04  Bruno Haible  <bruno@clisp.org>
+
+       getlocalename_l-unsafe: Improve support for Solaris 11 OpenIndiana.
+       Suggested by Andy Fiddaman <illumos@fiddaman.net> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2025-05/msg00018.html>.
+       * lib/getlocalename_l-unsafe.c (getlocalename_l_unsafe): On Solaris, use
+       the system's getlocalename_l() function if available.
+
 2025-05-04  Bruno Haible  <bruno@clisp.org>
 
        vc-mtime: Don't crash if xgetcwd() returns NULL.
index cb7ae5e5eac55c7172012a1d98f31c39d652a162..66b2c74726d938a2538c11c1c66d42b10803037c 100644 (file)
@@ -550,8 +550,14 @@ getlocalename_l_unsafe (int category, locale_t locale)
       /* We shouldn't get here.  */
       return (struct string_with_storage) { "", STORAGE_INDEFINITE };
 # else
-      /* Solaris 11 OpenIndiana.
-         For the internal structure of locale objects, see
+      /* Solaris 11 OpenIndiana or Solaris 11 OmniOS.  */
+#  if HAVE_GETLOCALENAME_L
+      /* illumos after April 2025.  */
+#   undef getlocalename_l
+      const char *name = getlocalename_l (category, locale);
+      return (struct string_with_storage) { name, STORAGE_OBJECT };
+#  else
+      /* For the internal structure of locale objects, see
          https://github.com/OpenIndiana/illumos-gate/blob/master/usr/src/lib/libc/port/locale/localeimpl.h  */
       switch (category)
         {
@@ -568,6 +574,7 @@ getlocalename_l_unsafe (int category, locale_t locale)
         default: /* We shouldn't get here.  */
           return (struct string_with_storage) { "", STORAGE_INDEFINITE };
         }
+#  endif
 # endif
 #elif HAVE_NAMELESS_LOCALES
       /* OpenBSD >= 6.2, AIX >= 7.1 */