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

Comparing ray/src/common/readobj.c (file contents):
Revision 2.22 by greg, Sat Apr 8 03:56:44 2017 UTC vs.
Revision 2.24 by greg, Sat Oct 17 16:39:23 2020 UTC

# Line 63 | Line 63 | readobj(                               /* read in an object file or stream */
63          }
64          if (inpspec[0] == '!')
65                  pclose(infp);
66 <        else
66 >        else if (infp != stdin)
67                  fclose(infp);
68          if (nobjects == lastobj) {
69                  sprintf(errmsg, "(%s): empty file", inpspec);
# Line 198 | Line 198 | freeobjects(                           /* free a range of objects */
198                  freefargs(&o->oargs);
199                  memset((void *)o, '\0', sizeof(OBJREC));
200          }
201        clearobjndx();
201                                          /* free objects off end */
202          for (obj = nobjects; obj-- > 0; )
203                  if (objptr(obj)->oname != NULL)
204                          break;
205 <        ++obj;
205 >        if (++obj >= nobjects)
206 >                return;
207          while (nobjects > obj)          /* free empty end blocks */
208                  if ((--nobjects & (OBJBLKSIZ-1)) == 0) {
209                          int     i = nobjects >> OBJBLKSHFT;
210                          free((void *)objblock[i]);
211                          objblock[i] = NULL;
212                  }
213 +        truncobjndx();                  /* truncate modifier look-up */
214   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines