]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
A few more macros so that localename.c can be shared with gnulib.
authorBruno Haible <bruno@clisp.org>
Thu, 7 Jun 2007 19:51:32 +0000 (19:51 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:54 +0000 (12:14 +0200)
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/gettextP.h
gettext-runtime/intl/localename.c

index 847cc05886fdbebfed488d1746f680521139f9b5..2966f06eb344b541d9d61bbb30cd6b3acf831485 100644 (file)
@@ -1,3 +1,16 @@
+2007-06-07  Bruno Haible  <bruno@clisp.org>
+
+       * gettextP.h (gl_locale_name_canonicalize, gl_locale_name_posix,
+       gl_locale_name_default, gl_locale_name): New macros.
+       (_nl_locale_name_canonicalize): New declaration.
+       * localename.c: Include config.h unconditionally. Include gettextP.h or
+       localename.h.
+       (gl_locale_name_canonicalize): Renamed from
+       _nl_locale_name_canonicalize. Make static except in libintl.
+       (gl_locale_name_posix): Renamed from _nl_locale_name_posix.
+       (gl_locale_name_default): Renamed from _nl_locale_name_default.
+       (gl_locale_name): Renamed from _nl_locale_name.
+
 2007-05-28  Bruno Haible  <bruno@clisp.org>
 
        * libintl.rc: New file.
index bba3c2ea8b755dba13296df709494cf9cdc8506b..fe18a442fb918877e7348eb939b27ebb5cd369ff 100644 (file)
@@ -1,5 +1,5 @@
 /* Header describing internals of libintl library.
-   Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
    This program is free software; you can redistribute it and/or modify it
@@ -219,10 +219,16 @@ extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr;
 #endif
 
 #ifndef _LIBC
-const char *_nl_language_preferences_default (void);
-const char *_nl_locale_name_posix (int category, const char *categoryname);
-const char *_nl_locale_name_default (void);
-const char *_nl_locale_name (int category, const char *categoryname);
+extern const char *_nl_language_preferences_default (void);
+# define gl_locale_name_canonicalize _nl_locale_name_canonicalize
+extern void _nl_locale_name_canonicalize (char *name);
+# define gl_locale_name_posix _nl_locale_name_posix
+extern const char *_nl_locale_name_posix (int category,
+                                         const char *categoryname);
+# define gl_locale_name_default _nl_locale_name_default
+extern const char *_nl_locale_name_default (void);
+# define gl_locale_name _nl_locale_name_default
+extern const char *_nl_locale_name (int category, const char *categoryname);
 #endif
 
 struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
index 95133b0b1e459175553c59efbe24f92941cb525c..af4c229a3094e6281deaee89c7b2151a8fcf6107 100644 (file)
@@ -1,5 +1,5 @@
-/* Determine the current selected locale.
-   Copyright (C) 1995-1999, 2000-2006 Free Software Foundation, Inc.
+/* Determine name of the currently selected locale.
+   Copyright (C) 1995-1999, 2000-2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU Library General Public License as published
 /* Win32 code written by Tor Lillqvist <tml@iki.fi>.  */
 /* MacOS X code written by Bruno Haible <bruno@clisp.org>.  */
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
+#include <config.h>
+
+/* Specification.  */
+#ifdef IN_LIBINTL
+# include "gettextP.h"
+#else
+# include "localename.h"
 #endif
 
 #include <stdlib.h>
    NAME is a sufficiently large buffer.
    On input, it contains the MacOS X locale name.
    On output, it contains the Unix locale name.  */
+#  if !defined IN_LIBINTL
+static
+#  endif
 void
-_nl_locale_name_canonicalize (char *name)
+gl_locale_name_canonicalize (char *name)
 {
   /* This conversion is based on a posting by
      Deborah GoldSmith <goldsmit@apple.com> on 2005-03-08,
@@ -984,7 +992,7 @@ _nl_locale_name_canonicalize (char *name)
    The result must not be freed; it is statically allocated.  */
 
 const char *
-_nl_locale_name_posix (int category, const char *categoryname)
+gl_locale_name_posix (int category, const char *categoryname)
 {
   /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
      On some systems this can be done by the 'setlocale' function itself.  */
@@ -1011,7 +1019,7 @@ _nl_locale_name_posix (int category, const char *categoryname)
 }
 
 const char *
-_nl_locale_name_default (void)
+gl_locale_name_default (void)
 {
   /* POSIX:2001 says:
      "All implementations shall define a locale as the default locale, to be
@@ -1051,7 +1059,7 @@ _nl_locale_name_default (void)
        if (CFStringGetCString (name, namebuf, sizeof(namebuf),
                                kCFStringEncodingASCII))
          {
-           _nl_locale_name_canonicalize (namebuf);
+           gl_locale_name_canonicalize (namebuf);
            cached_localename = strdup (namebuf);
          }
        CFRelease (locale);
@@ -1064,7 +1072,7 @@ _nl_locale_name_default (void)
            && CFStringGetCString ((CFStringRef)value, namebuf, sizeof(namebuf),
                                   kCFStringEncodingASCII))
          {
-           _nl_locale_name_canonicalize (namebuf);
+           gl_locale_name_canonicalize (namebuf);
            cached_localename = strdup (namebuf);
          }
 #  endif
@@ -1487,13 +1495,13 @@ _nl_locale_name_default (void)
 }
 
 const char *
-_nl_locale_name (int category, const char *categoryname)
+gl_locale_name (int category, const char *categoryname)
 {
   const char *retval;
 
-  retval = _nl_locale_name_posix (category, categoryname);
+  retval = gl_locale_name_posix (category, categoryname);
   if (retval != NULL)
     return retval;
 
-  return _nl_locale_name_default ();
+  return gl_locale_name_default ();
 }