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.21 by greg, Fri Dec 6 20:30:15 2024 UTC vs.
Revision 2.22 by greg, Fri Dec 6 20:54:23 2024 UTC

# Line 17 | Line 17 | static const char RCSid[] = "$Id$";
17  
18  
19   static struct ohtab {
20 <        int  hsiz;                      /* current table size */
21 <        OBJECT  *htab;                  /* table, if allocated */
20 >        int     hsiz;                   /* current table size */
21 >        OBJECT  *htab;                  /* table, if allocated */
22   }  modtab = {100, NULL}, objtab = {1000, NULL}; /* modifiers and objects */
23  
24   static int  otndx(char *, struct ohtab *);
# Line 48 | Line 48 | lastmod(                       /* find modifier definition before obj */
48   )
49   {
50          OBJREC  *op;
51 <        int  i;
51 >        OBJECT  i;
52  
53          i = modifier(mname);            /* try hash table first */
54          if ((obj == OVOID) | (i < obj))
55                  return(i);
56          for (i = obj; i-- > 0; ) {      /* need to search */
57                  op = objptr(i);
58 <                if (ismodifier(op->otype) && op->oname[0] == mname[0] &&
59 <                                        !strcmp(op->oname, mname))
58 >                if ((ismodifier(op->otype) != 0) & (op->oname[0] == mname[0])
59 >                                && !strcmp(op->oname, mname))
60                          return(i);
61          }
62          return(OVOID);
# Line 196 | Line 196 | truncobjndx(void)              /* remove bogus table entries past
196  
197          if (nobjects <= 0) {
198                  if (modtab.htab != NULL) {
199 <                        free((void *)modtab.htab);
199 >                        free(modtab.htab);
200                          modtab.htab = NULL;
201                          modtab.hsiz = 100;
202                  }
203                  if (objtab.htab != NULL) {
204 <                        free((void *)objtab.htab);
204 >                        free(objtab.htab);
205                          objtab.htab = NULL;
206                          objtab.hsiz = 100;
207                  }
# Line 278 | Line 278 | tryagain:
278                          i = otndx(onm, tab);
279                          tab->htab[i] = oldhtab[ndx];
280                  }
281 <        free((void *)oldhtab);
281 >        free(oldhtab);
282          goto tryagain;                  /* should happen only once! */
283   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines