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

Comparing ray/src/rt/freeobjmem.c (file contents):
Revision 2.3 by greg, Thu Feb 15 17:28:50 1996 UTC vs.
Revision 2.11 by greg, Thu Apr 4 18:51:18 2024 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Free memory associated with object(s)
6 + *
7 + * External symbols declared in ray.h
8   */
9  
10 < #include "standard.h"
11 < #include "object.h"
10 > #include "copyright.h"
11 >
12 > #include "ray.h"
13   #include "otypes.h"
14 + #include "rtotypes.h"
15 + #include "bsdf.h"
16 + #include "face.h"
17 + #include "cone.h"
18 + #include "instance.h"
19 + #include "data.h"
20 + #include "font.h"
21 + #include "func.h"
22 + #include "mesh.h"
23  
24  
25   int
26 < free_os(op)                     /* free unneeded memory for object */
27 < register OBJREC *op;
26 > free_os(                        /* free unneeded memory for object */
27 >        OBJREC  *op
28 > )
29   {
30          if (op->os == NULL)
31                  return(0);
# Line 37 | Line 47 | register OBJREC        *op;
47          case OBJ_INSTANCE:      /* octree instance */
48                  freeinstance(op);
49                  return(1);
50 +        case OBJ_MESH:          /* mesh instance */
51 +                freemeshinst(op);
52 +                return(1);
53          case PAT_BTEXT:         /* monochromatic text */
54          case PAT_CTEXT:         /* colored text */
55          case MIX_TEXT:          /* mixing text */
56                  freetext(op);
57                  return(1);
58          case MAT_CLIP:          /* clipping surface */
59 +        case MAT_SPOT:          /* spot light source */
60 +        case PAT_SPECTRUM:      /* constant spectrum */
61 +        case PAT_SPECFILE:      /* spectrum from data file */
62                  free(op->os);
63                  op->os = NULL;
64                  return(1);
65 <        case MAT_SPOT:          /* spot light source */
50 <                return(0);
51 <        default:
65 >        }
66   #ifdef DEBUG
67 <                objerror(op, WARNING, "cannot free structure");
67 >        objerror(op, WARNING, "cannot free structure");
68   #endif
69 <                return(0);
56 <        }
69 >        return(0);
70   }
71  
72  
73   int
74 < free_objs(on, no)               /* free some object structures */
75 < register OBJECT on;
76 < OBJECT  no;
74 > free_objs(              /* free some object structures */
75 >        OBJECT  on,
76 >        OBJECT  no
77 > )
78   {
79          int     nfreed;
80 <        register OBJREC *op;
80 >        OBJREC  *op;
81  
82          for (nfreed = 0; no-- > 0; on++) {
83                  op = objptr(on);
# Line 74 | Line 88 | OBJECT no;
88   }
89  
90  
91 < free_objmem()                   /* free all object cache memory */
91 > void
92 > free_objmem(void)                       /* free all object cache memory */
93   {
94          free_objs(0, nobjects);
95          freedata(NULL);
96          freefont(NULL);
97 +        SDfreeCache(NULL);
98   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines