]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
glibc 2003-06-11 Ulrich Drepper <drepper@redhat.com>
authorBruno Haible <bruno@clisp.org>
Mon, 9 May 2005 19:16:55 +0000 (19:16 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:34 +0000 (12:12 +0200)
Move the hash_string function to a separate file hash-string.c

12 files changed:
gettext-runtime/intl/ChangeLog
gettext-runtime/intl/Makefile.in
gettext-runtime/intl/Makefile.msvc
gettext-runtime/intl/Makefile.vms
gettext-runtime/intl/dcigettext.c
gettext-runtime/intl/hash-string.c [new file with mode: 0644]
gettext-runtime/intl/hash-string.h
gettext-runtime/intl/loadmsgcat.c
gettext-tools/src/ChangeLog
gettext-tools/src/Makefile.am
gettext-tools/src/Makefile.msvc
gettext-tools/src/Makefile.vms

index 5c3487e5e64b33abbba1b587aada61cb2595e9e8..a5a6b8cb3eceeb0dd42156c3d2e0ede696cdc5bc 100644 (file)
@@ -1,3 +1,24 @@
+2005-05-05  Bruno Haible  <bruno@clisp.org>
+
+       * hash-string.h (__hash_string): Define differently outside glibc.
+       * hash-string.c: Include config.h.
+       * Makefile.in (SOURCES): Add hash-string.c.
+       (OBJECTS): Add hash-string.$lo.
+       (hash-string.lo): New rule.
+       (hash-string.$lo): Depend on hash-string.h.
+       * Makefile.msvc (OBJECTS): Add hash-string.obj.
+       (hash-string.obj): New rule.
+       * Makefile.vms (OBJECTS): Add hash-string.obj.
+       (hash-string.obj): New rule.
+
+2003-06-11  Ulrich Drepper  <drepper@redhat.com>
+
+       Remove warnings gcc 3.3 shows.
+       * hash-string.c: New file.
+       * hash-string.h: Remove hash_string definition.  Declare __hash_string.
+       * dcigettext.c (_nl_find_msg): Adjust hash_string caller.
+       * loadmsgcat.c (_nl_load_domain): Likewise.
+
 2003-04-29  Jakub Jelinek  <jakub@redhat.com>
 
        * plural.y: Include string.h. Needed because recent versions of bison
index 1820f53745c21a5c4c52c764cf2dade8fefa89aa..5179258aaa0113d6fbf6f9d010892435cb757e3f 100644 (file)
@@ -85,6 +85,7 @@ SOURCES = \
   dgettext.c \
   gettext.c \
   finddomain.c \
+  hash-string.c \
   loadmsgcat.c \
   localealias.c \
   textdomain.c \
@@ -111,6 +112,7 @@ OBJECTS = \
   dgettext.$lo \
   gettext.$lo \
   finddomain.$lo \
+  hash-string.$lo \
   loadmsgcat.$lo \
   localealias.$lo \
   textdomain.$lo \
@@ -188,6 +190,8 @@ gettext.lo: $(srcdir)/gettext.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/gettext.c
 finddomain.lo: $(srcdir)/finddomain.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/finddomain.c
+hash-string.lo: $(srcdir)/hash-string.c
+       $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/hash-string.c
 loadmsgcat.lo: $(srcdir)/loadmsgcat.c
        $(LIBTOOL) --mode=compile $(COMPILE) $(srcdir)/loadmsgcat.c
 localealias.lo: $(srcdir)/localealias.c
@@ -426,7 +430,7 @@ info dvi ps pdf html:
 
 $(OBJECTS): ../config.h libgnuintl.h
 bindtextdom.$lo dcgettext.$lo dcigettext.$lo dcngettext.$lo dgettext.$lo dngettext.$lo finddomain.$lo gettext.$lo intl-compat.$lo loadmsgcat.$lo localealias.$lo ngettext.$lo textdomain.$lo: $(srcdir)/gettextP.h $(srcdir)/gmo.h $(srcdir)/loadinfo.h
-dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
+hash-string.$lo dcigettext.$lo loadmsgcat.$lo: $(srcdir)/hash-string.h
 explodename.$lo l10nflist.$lo: $(srcdir)/loadinfo.h
 dcigettext.$lo loadmsgcat.$lo plural.$lo plural-exp.$lo: $(srcdir)/plural-exp.h
 dcigettext.$lo: $(srcdir)/eval-plural.h
index 038321ee2ae7ac8f58dfa6ada508ab20ef6ea95e..c48e1d9ee872f468ed5fa8803247979fa385c58c 100644 (file)
@@ -99,7 +99,7 @@ INSTALL_DATA = copy
 
 SHELL = /bin/sh
 
-OBJECTS = bindtextdom.obj dcgettext.obj dgettext.obj gettext.obj finddomain.obj loadmsgcat.obj localealias.obj textdomain.obj l10nflist.obj explodename.obj dcigettext.obj dcngettext.obj dngettext.obj ngettext.obj plural.obj plural-exp.obj localcharset.obj relocatable.obj langprefs.obj localename.obj log.obj printf.obj osdep.obj intl-compat.obj
+OBJECTS = bindtextdom.obj dcgettext.obj dgettext.obj gettext.obj finddomain.obj hash-string.obj loadmsgcat.obj localealias.obj textdomain.obj l10nflist.obj explodename.obj dcigettext.obj dcngettext.obj dngettext.obj ngettext.obj plural.obj plural-exp.obj localcharset.obj relocatable.obj langprefs.obj localename.obj log.obj printf.obj osdep.obj intl-compat.obj
 
 RESOURCES = intl.res
 
@@ -127,6 +127,9 @@ gettext.obj : $(srcdir)\gettext.c libgnuintl.h $(srcdir)\gettextP.h $(srcdir)\gm
 finddomain.obj : $(srcdir)\finddomain.c libgnuintl.h $(srcdir)\gettextP.h $(srcdir)\gmo.h $(srcdir)\loadinfo.h
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\finddomain.c
 
+hash-string.obj : $(srcdir)\hash-string.c $(srcdir)\hash-string.h
+       $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\hash-string.c
+
 loadmsgcat.obj : $(srcdir)\loadmsgcat.c libgnuintl.h $(srcdir)\gettextP.h $(srcdir)\gmo.h $(srcdir)\loadinfo.h $(srcdir)\hash-string.h $(srcdir)\plural-exp.h
        $(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)\loadmsgcat.c
 
index aa5be49d81a73c097b867f5207417076b2d10cd8..65d814d859bdc99f8805137b9c2ae55cbfae5de5 100644 (file)
@@ -45,7 +45,7 @@ INSTALL_DATA = copy
 
 #### End of system configuration section. ####
 
-OBJECTS = bindtextdom.obj,dcgettext.obj,dgettext.obj,gettext.obj,finddomain.obj,loadmsgcat.obj,localealias.obj,textdomain.obj,l10nflist.obj,explodename.obj,dcigettext.obj,dcngettext.obj,dngettext.obj,ngettext.obj,plural-parse.obj,plural-exp.obj,localcharset.obj,relocatable.obj,langprefs.obj,localename.obj,log.obj,osdep.obj,intl-compat.obj
+OBJECTS = bindtextdom.obj,dcgettext.obj,dgettext.obj,gettext.obj,finddomain.obj,hash-string.obj,loadmsgcat.obj,localealias.obj,textdomain.obj,l10nflist.obj,explodename.obj,dcigettext.obj,dcngettext.obj,dngettext.obj,ngettext.obj,plural-parse.obj,plural-exp.obj,localcharset.obj,relocatable.obj,langprefs.obj,localename.obj,log.obj,osdep.obj,intl-compat.obj
 
 all : intl.olb,libintl.h
        write sys$output "Nothing else to be done for 'all'."
@@ -68,6 +68,9 @@ gettext.obj : $(srcdir)gettext.c,libgnuintl.h,$(srcdir)gettextP.h,$(srcdir)gmo.h
 finddomain.obj : $(srcdir)finddomain.c,libgnuintl.h,$(srcdir)gettextP.h,$(srcdir)gmo.h,$(srcdir)loadinfo.h
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)finddomain.c
 
+hash-string.obj : $(srcdir)hash-string.c,$(srcdir)hash-string.h
+       $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)hash-string.c
+
 loadmsgcat.obj : $(srcdir)loadmsgcat.c,libgnuintl.h,$(srcdir)gettextP.h,$(srcdir)gmo.h,$(srcdir)loadinfo.h,$(srcdir)hash-string.h,$(srcdir)plural-exp.h
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) $(srcdir)loadmsgcat.c
 
index 8cb5ec88daed239abe288abd2b9331512eac731e..a5d986592ccfe9295dd30713b00816bc8f91a3a2 100644 (file)
@@ -809,7 +809,7 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
     {
       /* Use the hashing table.  */
       nls_uint32 len = strlen (msgid);
-      nls_uint32 hash_val = hash_string (msgid);
+      nls_uint32 hash_val = __hash_string (msgid);
       nls_uint32 idx = hash_val % domain->hash_size;
       nls_uint32 incr = 1 + (hash_val % (domain->hash_size - 2));
 
diff --git a/gettext-runtime/intl/hash-string.c b/gettext-runtime/intl/hash-string.c
new file mode 100644 (file)
index 0000000..311ff10
--- /dev/null
@@ -0,0 +1,51 @@
+/* Implements a string hashing function.
+   Copyright (C) 1995, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+/* Specification.  */
+#include "hash-string.h"
+
+
+/* Defines the so called `hashpjw' function by P.J. Weinberger
+   [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
+   1986, 1987 Bell Telephone Laboratories, Inc.]  */
+unsigned long int
+__hash_string (const char *str_param)
+{
+  unsigned long int hval, g;
+  const char *str = str_param;
+
+  /* Compute the hash value for the given string.  */
+  hval = 0;
+  while (*str != '\0')
+    {
+      hval <<= 4;
+      hval += (unsigned char) *str++;
+      g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
+      if (g != 0)
+       {
+         hval ^= g >> (HASHWORDBITS - 8);
+         hval ^= g;
+       }
+    }
+  return hval;
+}
index 093e3b1c1036c2972d51a323a8c358aaecc0a840..3c52fce130346305dc0edf6acf32a586386ae849 100644 (file)
@@ -1,5 +1,5 @@
 /* Description of GNU message catalog format: string hashing function.
-   Copyright (C) 1995, 1997-1998, 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1997-1998, 2000-2003, 2005 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
 #define HASHWORDBITS 32
 
 
+#ifndef _LIBC
+# ifdef IN_LIBINTL
+#  define __hash_string libintl_hash_string
+# else
+#  define __hash_string hash_string
+# endif
+#endif
+
 /* Defines the so called `hashpjw' function by P.J. Weinberger
    [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
    1986, 1987 Bell Telephone Laboratories, Inc.]  */
-static inline unsigned long int
-hash_string (const char *str_param)
-{
-  unsigned long int hval, g;
-  const char *str = str_param;
-
-  /* Compute the hash value for the given string.  */
-  hval = 0;
-  while (*str != '\0')
-    {
-      hval <<= 4;
-      hval += (unsigned char) *str++;
-      g = hval & ((unsigned long int) 0xf << (HASHWORDBITS - 4));
-      if (g != 0)
-       {
-         hval ^= g >> (HASHWORDBITS - 8);
-         hval ^= g;
-       }
-    }
-  return hval;
-}
+extern unsigned long int __hash_string (const char *str_param);
index e708e20c78e43a54143a6c2fe21260b47f44dfa7..30c4e011c24d298f79c57ee8fd317c99be1b44a4 100644 (file)
@@ -1184,7 +1184,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file,
                    for (i = 0; i < n_inmem_sysdep_strings; i++)
                      {
                        const char *msgid = inmem_orig_sysdep_tab[i].pointer;
-                       nls_uint32 hash_val = hash_string (msgid);
+                       nls_uint32 hash_val = __hash_string (msgid);
                        nls_uint32 idx = hash_val % domain->hash_size;
                        nls_uint32 incr =
                          1 + (hash_val % (domain->hash_size - 2));
index 9b3c88191a95c026b7be9e70db4ebd3b028dc1ce..66c3998834ec8a7ef0922d1e43ac1d0fb140504c 100644 (file)
@@ -1,3 +1,11 @@
+2005-05-05  Bruno Haible  <bruno@clisp.org>
+
+       * Makefile.am (msgfmt_SOURCES): Add hash-string.c.
+       * Makefile.msvc (msgfmt_OBJECTS): Add hash-string.obj.
+       (hash-string.obj): New rule.
+       * Makefile.vms (msgfmt_OBJECTS): Add hash-string.obj.
+       (hash-string.obj): New rule.
+
 2005-05-01  Bruno Haible  <bruno@clisp.org>
 
        * x-sh.c (open_singlequote_terminator): New variable.
index b61968dc58655e34a1e63bdc927b2e72a9aed637..370010e13918ea80cdb59a9c79c67c0fca946ba2 100644 (file)
@@ -133,7 +133,7 @@ LIBUNINAME = ../libuniname/libuniname.a
 msgcmp_SOURCES = msgcmp.c
 msgfmt_SOURCES = msgfmt.c \
   write-mo.c write-java.c write-csharp.c write-resources.c write-tcl.c \
-  write-qt.c plural-eval.c
+  write-qt.c plural-eval.c ../../gettext-runtime/intl/hash-string.c
 msgmerge_SOURCES = msgmerge.c plural-count.c
 msgunfmt_SOURCES = msgunfmt.c \
   read-mo.c read-java.c read-csharp.c read-resources.c read-tcl.c
index 1a21328ed3494b124d285b2569309b492c7ad398..59926065651edeb5ff0ff3701b2c4579e1f86c4b 100644 (file)
@@ -151,7 +151,7 @@ OBJECTS = \
   format-qt.obj
 
 msgcmp_OBJECTS = msgcmp.obj
-msgfmt_OBJECTS = msgfmt.obj write-mo.obj write-java.obj write-csharp.obj write-resources.obj write-tcl.obj write-qt.obj plural-eval.obj
+msgfmt_OBJECTS = msgfmt.obj write-mo.obj write-java.obj write-csharp.obj write-resources.obj write-tcl.obj write-qt.obj plural-eval.obj hash-string.obj
 msgmerge_OBJECTS = msgmerge.obj plural-count.obj
 msgunfmt_OBJECTS = msgunfmt.obj read-mo.obj read-java.obj read-csharp.obj read-resources.obj read-tcl.obj
 xgettext_OBJECTS = xgettext.obj x-c.obj x-po.obj x-sh.obj x-python.obj x-lisp.obj x-elisp.obj x-librep.obj x-scheme.obj x-smalltalk.obj x-java.obj x-csharp.obj x-awk.obj x-ycp.obj x-tcl.obj x-perl.obj x-php.obj x-rst.obj x-glade.obj
@@ -351,6 +351,9 @@ write-qt.obj : write-qt.c
 plural-eval.obj : plural-eval.c
        $(CC) $(INCLUDES) $(CFLAGS) -c plural-eval.c
 
+hash-string.obj : ..\..\gettext-runtime\intl\hash-string.c
+       $(CC) $(INCLUDES) $(CFLAGS) -c ..\..\gettext-runtime\intl\hash-string.c
+
 msgmerge.obj : msgmerge.c
        $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c -Tp msgmerge.c
 
index 9b53a4d2dada258e1a7d7007013b514f7781ac5e..2d3766c56359ac62c0ca2f5b668816eefdd43da3 100644 (file)
@@ -97,7 +97,7 @@ OBJECTS = \
   format-qt.obj
 
 msgcmp_OBJECTS = msgcmp.obj
-msgfmt_OBJECTS = msgfmt.obj, write-mo.obj, write-java.obj, write-csharp.obj, write-resources.obj, write-tcl.obj, write-qt.obj, plural-eval.obj
+msgfmt_OBJECTS = msgfmt.obj, write-mo.obj, write-java.obj, write-csharp.obj, write-resources.obj, write-tcl.obj, write-qt.obj, plural-eval.obj, hash-string.obj
 msgmerge_OBJECTS = msgmerge.obj, plural-count.obj
 msgunfmt_OBJECTS = msgunfmt.obj, read-mo.obj, read-java.obj, read-csharp.obj, read-resources.obj, read-tcl.obj
 xgettext_OBJECTS = xgettext.obj, x-c.obj, x-po.obj, x-sh.obj, x-python.obj, x-lisp.obj, x-elisp.obj, x-librep.obj, x-scheme.obj, x-smalltalk.obj, x-java.obj, x-csharp.obj, x-awk.obj, x-ycp.obj, x-tcl.obj, x-perl.obj, x-php.obj, x-rst.obj, x-glade.obj
@@ -281,6 +281,9 @@ write-qt.obj : write-qt.c
 plural-eval.obj : plural-eval.c
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) plural-eval.c
 
+hash-string.obj : [-.-.gettext-runtime.intl]hash-string.c
+       $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) [-.-.gettext-runtime.intl]hash-string.c
+
 msgmerge.obj : msgmerge.c
        $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") msgmerge.c