Updated gllib and added hash-pjw-bare.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 2 Oct 2012 18:17:46 +0000 (20:17 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 2 Oct 2012 18:17:46 +0000 (20:17 +0200)
lib/gllib/Makefile.am
lib/gllib/dummy.c [deleted file]
lib/gllib/hash-pjw-bare.c [new file with mode: 0644]
lib/gllib/hash-pjw-bare.h [new file with mode: 0644]
lib/gllib/stdint.in.h
lib/glm4/extensions.m4
lib/glm4/gnulib-cache.m4
lib/glm4/gnulib-common.m4
lib/glm4/gnulib-comp.m4
lib/glm4/multiarch.m4
lib/glm4/visibility.m4

index 86fef38..519e32e 100644 (file)
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files lib-symbol-versions lib-symbol-visibility stdint strverscmp
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare lib-symbol-versions lib-symbol-visibility stdint strverscmp
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -50,6 +50,12 @@ EXTRA_libgnu_la_SOURCES =
 libgnu_la_LDFLAGS = $(AM_LDFLAGS)
 libgnu_la_LDFLAGS += -no-undefined
 
+## begin gnulib module hash-pjw-bare
+
+libgnu_la_SOURCES += hash-pjw-bare.h hash-pjw-bare.c
+
+## end   gnulib module hash-pjw-bare
+
 ## begin gnulib module lib-symbol-visibility
 
 # The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
@@ -318,12 +324,6 @@ EXTRA_libgnu_la_SOURCES += strverscmp.c
 
 ## end   gnulib module strverscmp
 
-## begin gnulib module dummy
-
-libgnu_la_SOURCES += dummy.c
-
-## end   gnulib module dummy
-
 
 mostlyclean-local: mostlyclean-generic
        @for dir in '' $(MOSTLYCLEANDIRS); do \
diff --git a/lib/gllib/dummy.c b/lib/gllib/dummy.c
deleted file mode 100644 (file)
index ea1f46f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* A dummy file, to prevent empty libraries from breaking builds.
-   Copyright (C) 2004, 2007, 2009-2012 Free Software Foundation, Inc.
-
-   This program 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.
-
-   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
-   libraries without any object files.  You might get an error like:
-
-   > ar cru .libs/libgl.a
-   > ar: no archive members specified
-
-   Compiling this file, and adding its object file to the library, will
-   prevent the library from being empty.  */
-
-/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
-   that don't export any symbol.  You might get an error like:
-
-   > cc ... libgnu.a
-   > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
-
-   Compiling this file, and adding its object file to the library, will
-   prevent the library from exporting no symbols.  */
-
-#ifdef __sun
-/* This declaration ensures that the library will export at least 1 symbol.  */
-int gl_dummy_symbol;
-#else
-/* This declaration is solely to ensure that after preprocessing
-   this file is never empty.  */
-typedef int dummy;
-#endif
diff --git a/lib/gllib/hash-pjw-bare.c b/lib/gllib/hash-pjw-bare.c
new file mode 100644 (file)
index 0000000..92101e3
--- /dev/null
@@ -0,0 +1,42 @@
+/* hash-pjw-bare.c -- compute a hash value from a provided buffer.
+
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This program 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.
+
+   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include "hash-pjw-bare.h"
+
+#include <limits.h>
+
+#define SIZE_BITS (sizeof (size_t) * CHAR_BIT)
+
+/* Return a hash of the N bytes of X using the method described by
+   Bruno Haible in http://www.haible.de/bruno/hashfunc.html.
+   Note that while many hash functions reduce their result via modulo
+   to a 0..table_size-1 range, this function does not do that.  */
+
+size_t
+hash_pjw_bare (const void *x, size_t n)
+{
+  const unsigned char *s = x;
+  size_t h = 0;
+  unsigned i;
+
+  for (i = 0; i < n; i++)
+    h = s[i] + ((h << 9) | (h >> (SIZE_BITS - 9)));
+
+  return h;
+}
diff --git a/lib/gllib/hash-pjw-bare.h b/lib/gllib/hash-pjw-bare.h
new file mode 100644 (file)
index 0000000..60852d1
--- /dev/null
@@ -0,0 +1,24 @@
+/* hash-pjw-bare.h -- declaration for a simple hash function
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This program 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.
+
+   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#include <stddef.h>
+
+/* Compute a hash code for a buffer starting at X and of size N,
+   and return the hash code.  Note that unlike hash_pjw(), it does not
+   return it modulo a table size.
+   The result is platform dependent: it depends on the size of the 'size_t'
+   type and on the signedness of the 'char' type.  */
+extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE;
index 3475dbe..4f61f95 100644 (file)
@@ -83,7 +83,7 @@
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
    AIX 5.2 <sys/types.h> isn't needed and causes troubles.
-   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+   Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
    relies on the system <stdint.h> definitions, so include
    <sys/types.h> after @NEXT_STDINT_H@.  */
 #if @HAVE_SYS_TYPES_H@ && ! defined _AIX
index 0bfaef6..6d17d8a 100644 (file)
@@ -1,4 +1,4 @@
-# serial 11  -*- Autoconf -*-
+# serial 12  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc.
@@ -67,7 +67,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-/* Enable general extensions on MacOS X.  */
+/* Enable general extensions on Mac OS X.  */
 #ifndef _DARWIN_C_SOURCE
 # undef _DARWIN_C_SOURCE
 #endif
index d0e6acb..1037f83 100644 (file)
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files lib-symbol-versions lib-symbol-visibility stdint strverscmp
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib/gllib --m4-base=lib/glm4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=lgl --no-vc-files hash-pjw-bare lib-symbol-versions lib-symbol-visibility stdint strverscmp
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
+  hash-pjw-bare
   lib-symbol-versions
   lib-symbol-visibility
   stdint
@@ -49,5 +50,5 @@ gl_MAKEFILE_NAME([])
 gl_LIBTOOL
 gl_MACRO_PREFIX([lgl])
 gl_PO_DOMAIN([])
-gl_WITNESS_C_DOMAIN([])
+gl_WITNESS_C_MACRO([])
 gl_VC_FILES([false])
index d62b767..15d2b2b 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 32
+# gnulib-common.m4 serial 33
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -30,7 +30,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
    the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
    earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
-   __APPLE__ && __MACH__ test for MacOS X.
+   __APPLE__ && __MACH__ test for Mac OS X.
    __APPLE_CC__ tests for the Apple compiler and its version.
    __STDC_VERSION__ tests for the C99 mode.  */
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
index b1d2854..6badef8 100644 (file)
@@ -40,6 +40,7 @@ AC_DEFUN([lgl_EARLY],
   AC_REQUIRE([gl_PROG_AR_RANLIB])
   # Code from module extensions:
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  # Code from module hash-pjw-bare:
   # Code from module include_next:
   # Code from module lib-symbol-versions:
   # Code from module lib-symbol-visibility:
@@ -67,18 +68,18 @@ AC_DEFUN([lgl_INIT],
   m4_pushdef([lgl_LIBSOURCES_DIR], [])
   gl_COMMON
   gl_source_base='lib/gllib'
-gl_LD_VERSION_SCRIPT
-gl_VISIBILITY
-gl_MULTIARCH
-gl_STDDEF_H
-gl_STDINT_H
-gl_HEADER_STRING_H
-gl_FUNC_STRVERSCMP
-if test $HAVE_STRVERSCMP = 0; then
-  AC_LIBOBJ([strverscmp])
-  gl_PREREQ_STRVERSCMP
-fi
-gl_STRING_MODULE_INDICATOR([strverscmp])
+  gl_LD_VERSION_SCRIPT
+  gl_VISIBILITY
+  gl_MULTIARCH
+  gl_STDDEF_H
+  gl_STDINT_H
+  gl_HEADER_STRING_H
+  gl_FUNC_STRVERSCMP
+  if test $HAVE_STRVERSCMP = 0; then
+    AC_LIBOBJ([strverscmp])
+    gl_PREREQ_STRVERSCMP
+  fi
+  gl_STRING_MODULE_INDICATOR([strverscmp])
   # End of code from modules
   m4_ifval(lgl_LIBSOURCES_LIST, [
     m4_syscmd([test ! -d ]m4_defn([lgl_LIBSOURCES_DIR])[ ||
@@ -218,7 +219,8 @@ AC_DEFUN([lgl_FILE_LIST], [
   build-aux/snippet/arg-nonnull.h
   build-aux/snippet/c++defs.h
   build-aux/snippet/warn-on-use.h
-  lib/dummy.c
+  lib/hash-pjw-bare.c
+  lib/hash-pjw-bare.h
   lib/stddef.in.h
   lib/stdint.in.h
   lib/string.in.h
index b424dce..0c288b8 100644 (file)
@@ -1,4 +1,4 @@
-# multiarch.m4 serial 6
+# multiarch.m4 serial 7
 dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 # Determine whether the compiler is or may be producing universal binaries.
 #
-# On MacOS X 10.5 and later systems, the user can create libraries and
+# On Mac OS X 10.5 and later systems, the user can create libraries and
 # executables that work on multiple system types--known as "fat" or
 # "universal" binaries--by specifying multiple '-arch' options to the
 # compiler but only a single '-arch' option to the preprocessor.  Like
index 7b24d39..a7d4d8c 100644 (file)
@@ -1,4 +1,4 @@
-# visibility.m4 serial 4 (gettext-0.18.2)
+# visibility.m4 serial 5 (gettext-0.18.2)
 dnl Copyright (C) 2005, 2008, 2010-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ dnl __attribute__((__visibility__("hidden"))) and
 dnl __attribute__((__visibility__("default"))).
 dnl Does *not* test for __visibility__("protected") - which has tricky
 dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
-dnl MacOS X.
+dnl Mac OS X.
 dnl Does *not* test for __visibility__("internal") - which has processor
 dnl dependent semantics.
 dnl Does *not* test for #pragma GCC visibility push(hidden) - which is