]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* hashtab.c (htab_expand): Fix allocation of new entries.
authorJosef Zlomek <zlomekj@suse.cz>
Mon, 20 Jan 2003 19:05:39 +0000 (20:05 +0100)
committerJosef Zlomek <zlomek@gcc.gnu.org>
Mon, 20 Jan 2003 19:05:39 +0000 (19:05 +0000)
From-SVN: r61510

libiberty/ChangeLog
libiberty/hashtab.c

index daed95b74a9e26b0fa78d217c33d1fb92a7d1ec6..9e7fc1df422bf9d803a4cdb0fea67d97df075178 100644 (file)
@@ -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.
index 7477c35c3bc0b93eb65f2dca76bbd73a681d2e3d..37230d9f37c3a35f5aff6441fe05a109b15b2476 100644 (file)
@@ -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;