1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

Update from gnulib.

This commit is contained in:
Jim Meyering
2003-10-31 14:00:18 +00:00
parent 7291dc2b9d
commit f7f606641f
2 changed files with 7 additions and 3 deletions

View File

@@ -18,4 +18,8 @@
#include <stddef.h> #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);

View File

@@ -568,10 +568,10 @@ hash_initialize (size_t candidate, const Hash_tuning *tuning,
candidate = new_candidate; candidate = new_candidate;
} }
if (SIZE_MAX / sizeof *table->bucket < candidate) if (xalloc_oversized (candidate, sizeof *table->bucket))
goto fail; goto fail;
table->n_buckets = next_prime (candidate); 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; goto fail;
table->bucket = calloc (table->n_buckets, sizeof *table->bucket); table->bucket = calloc (table->n_buckets, sizeof *table->bucket);