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.30 by greg, Mon Jun 23 19:56:47 2025 UTC vs.
Revision 2.31 by greg, Tue Jun 24 21:04:16 2025 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #include "copyright.h"
11  
12   #include  <ctype.h>
13 #include  <string.h>
14 #include  <stdio.h>
13  
14   #include  "platform.h"
15   #include  "standard.h"
# Line 19 | Line 17 | static const char RCSid[] = "$Id$";
17   #include  "otypes.h"
18  
19   #ifndef OBJMEMOPT
20 < #define OBJMEMOPT       1               /* optimize object block memory? */
20 > #define OBJMEMOPT       0               /* optimize object block memory? */
21   #endif
22  
23   OBJREC  *objblock[MAXOBJBLK];           /* our objects */
# Line 184 | Line 182 | optimize_objblock(int i)               /* consolidate memory in obj
182          unsigned long   sargcnt = 0, iargcnt = 0, fargcnt = 0, namecnt = 0;
183  
184          if (i < 0 || objblock[i] == NULL || objblock[i][OBJBLKSIZ].otype < 0)
185 <                return;                 /* invalid or already flagged */
185 >                return;                 /* invalid or already done */
186  
187          for (o = objblock[i]+OBJBLKSIZ; o-- > objblock[i]; ) {
188                  if (o->oname == NULL)   /* too early to optimize? */
# Line 199 | Line 197 | optimize_objblock(int i)               /* consolidate memory in obj
197   #endif
198                  namecnt += strlen(o->oname)+1;
199          }
200 <        if (n < OBJBLKSIZ/10)   /* never happens? */
200 >        if (n < OBJBLKSIZ/10)           /* never happens? */
201                  return;
202                                          /* prep consolidation object */
203          co = objblock[i]+OBJBLKSIZ;
# Line 215 | Line 213 | optimize_objblock(int i)               /* consolidate memory in obj
213                          (co->oargs.farg == NULL)) {
214                  free(co->oname);
215                  free(co->oargs.sarg); free(co->oargs.farg);
216 +                memset(co, 0, sizeof(OBJREC));
217                  return;                 /* insufficient memory */
218          }
219   #ifdef  IARGS
# Line 223 | Line 222 | optimize_objblock(int i)               /* consolidate memory in obj
222          if (co->oargs.iarg == NULL) {
223                  free(co->oname);
224                  free(co->oargs.sarg); free(co->oargs.farg);
225 +                memset(co, 0, sizeof(OBJREC));
226                  return;                 /* insufficient memory */
227          }
228          iargcnt = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines