]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Update from gnulib.
authorJim Meyering <jim@meyering.net>
Fri, 31 Oct 2003 14:00:18 +0000 (14:00 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 31 Oct 2003 14:00:18 +0000 (14:00 +0000)
lib/hash-pjw.h
lib/hash.c

index b2a09949439c3eb99639f652d08838c30771c2fe..5847a25280cf58d7f3569079a2e16c816f93e01d 100644 (file)
@@ -18,4 +18,8 @@
 
 #include <stddef.h>
 
-size_t hash_pjw (void const *x, size_t tablesize);
+/* Compute a hash code for a NUL-terminated string starting at X,
+   and return the hash code modulo TABLESIZE.
+   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 (void const *x, size_t tablesize);
index ad4599e4d5173e8a38c6a4e77bdae01eb0120f23..19e593fef42f04dc106adcdb68255f3964154f7b 100644 (file)
@@ -568,10 +568,10 @@ hash_initialize (size_t candidate, const Hash_tuning *tuning,
       candidate = new_candidate;
     }
 
-  if (SIZE_MAX / sizeof *table->bucket < candidate)
+  if (xalloc_oversized (candidate, sizeof *table->bucket))
     goto fail;
   table->n_buckets = next_prime (candidate);
-  if (SIZE_MAX / sizeof *table->bucket < table->n_buckets)
+  if (xalloc_oversized (table->n_buckets, sizeof *table->bucket))
     goto fail;
 
   table->bucket = calloc (table->n_buckets, sizeof *table->bucket);