]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Keep in sync with new bind_textdomain_codeset function in libintl.glibc.
authorBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 18:48:22 +0000 (18:48 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 18:48:22 +0000 (18:48 +0000)
intl/ChangeLog
intl/cat-compat.c
intl/intl-compat.c
intl/intlh.inst.in
intl/libgettext.h

index 64ae2205c61b547c91a9657f1b9d829889646ae0..c58e11f596aae26f17b26aaaa1fa251d06d5ed49 100644 (file)
@@ -1,5 +1,12 @@
 2000-06-16  Bruno Haible  <haible@clisp.cons.org>
 
+       * intlh.inst.in (bind_textdomain_codeset): New declaration.
+       * libgettext.h (bind_textdomain_codeset, bind_textdomain_codeset__):
+       New declarations.
+       (bind_textdomain_codeset) [!ENABLE_NLS]: New macro.
+       * cat-compat.c (bind_textdomain_codeset): New function.
+       * intl-compat.c (bind_textdomain_codeset): New function.
+
        * libgettext.h (ngettext, dngettext, dcngettext): New
        declarations.
        (dcgettext): Remove macro definition.
index 867d901b8ffc53d52a2fde6b1812adf88f97d9e7..89aa0aafc0eae5948e927aa34981c960750cb120 100644 (file)
@@ -1,5 +1,5 @@
 /* Compatibility code for gettext-using-catgets interface.
-   Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -37,6 +37,12 @@ char *getenv ();
 
 #include "libgettext.h"
 
+/* Tell the compiler when a conditional or integer expression is
+   almost always true or almost always false.  */
+#ifndef HAVE_BUILTIN_EXPECT
+# define __builtin_expect(expr, val) (expr)
+#endif
+
 /* @@ end of prolog @@ */
 
 /* XPG3 defines the result of `setlocale (category, NULL)' as:
@@ -206,6 +212,21 @@ bindtextdomain (domainname, dirname)
   return (char *) domainname;
 }
 
+char *
+bind_textdomain_codeset (domainname, codeset)
+     const char *domainname;
+     const char *codeset;
+{
+  /* This does not make much sense here but to be compatible do it.  */
+  if (domainname == NULL)
+    return NULL;
+
+  /* catgets doesn't support character codeset conversion.  We could
+     call iconv() ourselves in gettext, but that's outside of the scope
+     of this compatibility hack.  */
+  return (char *) codeset;
+}
+
 #undef gettext
 char *
 gettext (msg)
@@ -236,7 +257,7 @@ msg_to_cat_id (msg)
   int cnt;
 
   for (cnt = 0; cnt < _msg_tbl_length; ++cnt)
-    if (strcmp (msg, _msg_tbl[cnt]._msg) == 0)
+    if (__builtin_expect (strcmp (msg, _msg_tbl[cnt]._msg) == 0, 0))
       return _msg_tbl[cnt]._msg_number;
 
   return -1;
index 503efa0fa9c5179f26a8b6cbd57ec36e1398b662..c6aeb4677d93210b40a83b3a4dd0085e69aa7f81 100644 (file)
@@ -1,6 +1,6 @@
 /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
    Library.
-   Copyright (C) 1995 Software Foundation, Inc.
+   Copyright (C) 1995, 2000 Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #undef dcgettext
 #undef textdomain
 #undef bindtextdomain
+#undef bind_textdomain_codeset
 
 
 char *
@@ -41,6 +42,15 @@ bindtextdomain (domainname, dirname)
 }
 
 
+char *
+bind_textdomain_codeset (domainname, codeset)
+     const char *domainname;
+     const char *codeset;
+{
+  return bind_textdomain_codeset__ (domainname, codeset);
+}
+
+
 char *
 dcgettext (domainname, msgid, category)
      const char *domainname;
index d2630243e5645547d4e7d8fcc3d0dc7c0f378f42..8a30511f7700d8d9ac3c962adaa4cb9fea8c9dad 100644 (file)
@@ -78,6 +78,11 @@ extern char *textdomain PARAMS ((const char *__domainname));
 extern char *bindtextdomain PARAMS ((const char *__domainname,
                                     const char *__dirname));
 
+/* Specify the character encoding in which the messages from the
+   DOMAINNAME message catalog will be returned.  */
+extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
+                                             const char *__codeset));
+
 
 /* Optimized version of the functions above.  */
 #if defined __OPTIMIZED
index 9ed6f0dec59488d0f9966627ecfdb6e01b3c4a6c..58c83e6fa04d63412aad015cfcc01de390ccc99f 100644 (file)
@@ -1,5 +1,5 @@
 /* Message catalogs for internationalization.
-   Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -134,9 +134,16 @@ extern char *textdomain__ PARAMS ((const char *__domainname));
 /* Specify that the DOMAINNAME message catalog will be found
    in DIRNAME rather than in the system locale data base.  */
 extern char *bindtextdomain PARAMS ((const char *__domainname,
-                                 const char *__dirname));
+                                    const char *__dirname));
 extern char *bindtextdomain__ PARAMS ((const char *__domainname,
-                                   const char *__dirname));
+                                      const char *__dirname));
+
+/* Specify the character encoding in which the messages from the
+   DOMAINNAME message catalog will be returned.  */
+extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
+                                             const char *__codeset));
+extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
+                                               const char *__codeset));
 
 #if ENABLE_NLS
 
@@ -172,6 +179,7 @@ extern char *bindtextdomain__ PARAMS ((const char *__domainname,
     ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2))
 # define textdomain(Domainname) ((char *) (Domainname))
 # define bindtextdomain(Domainname, Dirname) ((char *) (Dirname))
+# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset))
 
 #endif