* lib/hashcode-mem.h: Renamed from lib/hash-pjw-bare.h.
* lib/hashcode-mem.c: Renamed from lib/hash-pjw-bare.c.
* lib/hash-pjw-bare.h: New file.
* modules/hashcode-mem: Renamed from modules/hash-pjw-bare.
* modules/hash-pjw-bare: New file.
* MODULES.html.sh: Update.
+2025-04-29 Bruno Haible <bruno@clisp.org>
+
+ Rename module hash-pjw-bare to hashcode-mem.
+ * lib/hashcode-mem.h: Renamed from lib/hash-pjw-bare.h.
+ * lib/hashcode-mem.c: Renamed from lib/hash-pjw-bare.c.
+ * lib/hash-pjw-bare.h: New file.
+ * modules/hashcode-mem: Renamed from modules/hash-pjw-bare.
+ * modules/hash-pjw-bare: New file.
+ * MODULES.html.sh: Update.
+
2025-04-29 Bruno Haible <bruno@clisp.org>
hash: Remove deprecated function 'hash_delete'.
func_module obstack-printf
func_module obstack-printf-posix
func_module hash-pjw
- func_module hash-pjw-bare
+ func_module hashcode-mem
func_module hash
func_module hamt
func_module readline
+++ /dev/null
-/* hash-pjw-bare.c -- compute a hash value from a provided buffer.
-
- Copyright (C) 2012-2025 Free Software Foundation, Inc.
-
- This file 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 file 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 <https://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 https://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;
-}
/* hash-pjw-bare.h -- declaration for a simple hash function
- Copyright (C) 2012-2025 Free Software Foundation, Inc.
+ Copyright (C) 2025 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
-/* This file uses _GL_ATTRIBUTE_PURE. */
-#if !_GL_CONFIG_H_INCLUDED
- #error "Please include config.h first."
-#endif
-
-#include <stddef.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* 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. */
-extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE;
-
+#include "hashcode-mem.h"
-#ifdef __cplusplus
-}
+#if __GNUC__ || (__clang_major__ >= 4)
+# warning "The include file hash-pjw-bare.h is deprecated. Use hashcode-mem.h instead."
#endif
--- /dev/null
+/* hashcode-mem.c -- compute a hash value from a provided buffer.
+
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
+
+ This file 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 file 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 <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "hashcode-mem.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 https://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;
+}
--- /dev/null
+/* hashcode-mem.h -- declaration for a simple hash function
+ Copyright (C) 2012-2025 Free Software Foundation, Inc.
+
+ This file 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 file 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 <https://www.gnu.org/licenses/>. */
+
+/* This file uses _GL_ATTRIBUTE_PURE. */
+#if !_GL_CONFIG_H_INCLUDED
+ #error "Please include config.h first."
+#endif
+
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* 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. */
+extern size_t hash_pjw_bare (const void *x, size_t n) _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
Description:
Compute a hash value for a buffer of known size.
+Status:
+deprecated
+
+Notice:
+This module is deprecated. Use the module 'hashcode-mem' instead.
+
Files:
-lib/hash-pjw-bare.h
-lib/hash-pjw-bare.c
Depends-on:
+hashcode-mem
configure.ac:
Makefile.am:
-lib_SOURCES += hash-pjw-bare.h hash-pjw-bare.c
Include:
-"hash-pjw-bare.h"
+"hashcode-mem.h"
License:
LGPLv2+
Maintainer:
-Jim Meyering
--- /dev/null
+Description:
+Compute a hash value for a buffer of known size.
+
+Files:
+lib/hashcode-mem.h
+lib/hashcode-mem.c
+lib/hash-pjw-bare.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += hashcode-mem.h hashcode-mem.c
+
+Include:
+"hashcode-mem.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+Jim Meyering