aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorJosef Zlomek <zlomekj@suse.cz>2003-01-20 20:05:39 +0100
committerJosef Zlomek <zlomek@gcc.gnu.org>2003-01-20 19:05:39 +0000
commit2cfbade431df029c7aa475c6608ada0c4a8d55e0 (patch)
tree7fa2bdac3164ba3b61df0f3a99239fd48f82b682 /libiberty
parent7699a93c9989475b12cfd26a40a2fdb09bd2c904 (diff)
downloadgcc-2cfbade431df029c7aa475c6608ada0c4a8d55e0.zip
gcc-2cfbade431df029c7aa475c6608ada0c4a8d55e0.tar.gz
gcc-2cfbade431df029c7aa475c6608ada0c4a8d55e0.tar.bz2
* hashtab.c (htab_expand): Fix allocation of new entries.
From-SVN: r61510
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog4
-rw-r--r--libiberty/hashtab.c8
2 files changed, 9 insertions, 3 deletions
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 <zlomekj@suse.cz>
+
+ * 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;