yuki@rei.stars.flab.Fujitsu.JUNET (Hiroyuki YOSHIDA) (10/19/88)
I found two bugs of ExpandTable in Event.c. (This article includes a
patch.) They are:
(1) It forgets to clear the new hash table.
(2) It fails to reset "table->count".
The bugs appear when there are more than 820 widgets. Probably, I'm
the first man who made so many widgets. (Of course, becuase of my own
bug :-)
-- cut here --
*** Event.c.orig Wed Aug 3 10:16:50 1988
--- Event.c Wed Oct 19 11:07:49 1988
***************
*** 268,279 ****
{
HashTable oldTable = table;
unsigned int i;
i = oldTable->size * 2;
! table = (HashTable) XtMalloc(
! (unsigned) sizeof(HashTableRec)+i*sizeof(HashRec));
table->size = i;
! table->count = oldTable->count;
for (i = 0; i<oldTable->size; i++) {
HashPtr hp;
hp = oldTable->entries[i];
--- 268,281 ----
{
HashTable oldTable = table;
unsigned int i;
+ int size;
i = oldTable->size * 2;
! size = sizeof(HashTableRec)+i*sizeof(HashPtr);
! table = (HashTable) XtMalloc((unsigned) size);
! bzero((char *) table, size);
table->size = i;
! table->count = 0;
for (i = 0; i<oldTable->size; i++) {
HashPtr hp;
hp = oldTable->entries[i];
--
Hiroyuki Yoshida
yuki@flab.Fujitsu.JUNET
yuki%flab.Fujitsu.JUNET@uunet.uu.NET