[comp.windows.x] Bugs of ExpandTable

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

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (10/21/88)

    Date: 19 Oct 88 04:41:15 GMT
    From: hpda!hpycla!ascgw!fgw!flab!ayumi!yuki@bloom-beacon.mit.edu  (Hiroyuki YOSHIDA)

    Probably, I'm the first man who made so many widgets.

Nope.  This bug is fixed in R3.

swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/21/88)

> The bugs appear when there are more than 820 widgets. Probably, I'm 
> the first man who made so many widgets.

Nope, you're not the first.  Thanks for your report, though.  The
old fix never made it out to xstuff, and your report pointed out
one other improvement.