ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/modobject.c
(Generate patch)

Comparing ray/src/common/modobject.c (file contents):
Revision 2.18 by greg, Sat Oct 17 16:39:23 2020 UTC vs.
Revision 2.19 by greg, Sat Oct 17 17:48:46 2020 UTC

# Line 222 | Line 222 | nexthsiz(                      /* return next hash table size */
222   )
223   {
224          static int  hsiztab[] = {
225 <                251, 509, 1021, 2039, 4093, 8191, 16381, 0
225 >                251, 509, 1021, 2039, 4093, 8191, 16381,
226 >                32749, 65521, 131071, 262139, 0
227          };
228          int  *hsp;
229  
# Line 239 | Line 240 | otndx(                         /* get object table index for name */
240          struct ohtab  *tab
241   )
242   {
243 +        char    *onm;
244          OBJECT  *oldhtab;
245          int  hval, i;
246          int  ndx;
# Line 257 | Line 259 | otndx(                         /* get object table index for name */
259   tryagain:
260          for (i = 0; i < tab->hsiz; i++) {
261                  ndx = (hval + (unsigned long)i*i) % tab->hsiz;
262 <                if (tab->htab[ndx] == OVOID ||
261 <                                !strcmp(objptr(tab->htab[ndx])->oname, name))
262 >                if (tab->htab[ndx] == OVOID)
263                          return(ndx);
264 +                onm = objptr(tab->htab[ndx])->oname;
265 +                if (onm != NULL && !strcmp(onm, name))
266 +                        return(ndx);
267          }
268                                          /* table is full, reallocate */
269          oldhtab = tab->htab;
# Line 267 | Line 271 | tryagain:
271          tab->htab = NULL;
272          while (ndx--)
273                  if (oldhtab[ndx] != OVOID) {
274 <                        i = otndx(objptr(oldhtab[ndx])->oname, tab);
274 >                        onm = objptr(oldhtab[ndx])->oname;
275 >                        if (onm == NULL)
276 >                                continue;
277 >                        i = otndx(onm, tab);
278                          tab->htab[i] = oldhtab[ndx];
279                  }
280          free((void *)oldhtab);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines