From 2cfbade431df029c7aa475c6608ada0c4a8d55e0 Mon Sep 17 00:00:00 2001 From: Josef Zlomek Date: Mon, 20 Jan 2003 20:05:39 +0100 Subject: * hashtab.c (htab_expand): Fix allocation of new entries. From-SVN: r61510 --- libiberty/ChangeLog | 4 ++++ libiberty/hashtab.c | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'libiberty') diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index daed95b..9e7fc1d 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2003-01-20 Josef Zlomek + + * hashtab.c (htab_expand): Fix allocation of new entries. + 2002-11-19 Release Manager * GCC 3.2.1 Released. diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c index 7477c35..37230d9 100644 --- a/libiberty/hashtab.c +++ b/libiberty/hashtab.c @@ -302,22 +302,24 @@ htab_expand (htab) PTR *oentries; PTR *olimit; PTR *p; + size_t nsize; oentries = htab->entries; olimit = oentries + htab->size; - htab->size = higher_prime_number (htab->size * 2); + nsize = higher_prime_number (htab->size * 2); if (htab->return_allocation_failure) { - PTR *nentries = (PTR *) calloc (htab->size, sizeof (PTR *)); + PTR *nentries = (PTR *) calloc (nsize, sizeof (PTR)); if (nentries == NULL) return 0; htab->entries = nentries; } else - htab->entries = (PTR *) xcalloc (htab->size, sizeof (PTR *)); + htab->entries = (PTR *) xcalloc (nsize, sizeof (PTR)); + htab->size = nsize; htab->n_elements -= htab->n_deleted; htab->n_deleted = 0; -- cgit v1.1