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.2 by greg, Wed Feb 10 12:51:40 1993 UTC vs.
Revision 2.8 by greg, Fri Feb 18 00:40:25 2011 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;
25 > extern int
26 > free_os(                        /* free unneeded memory for object */
27 >        register 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 <                free(op->os);
59 >        case MAT_SPOT:          /* spot light source */
60 >                free((void *)op->os);
61                  op->os = NULL;
62                  return(1);
63 <        case MAT_SPOT:          /* spot light source */
50 <                return(0);
51 <        default:
63 >        }
64   #ifdef DEBUG
65 <                objerror(op, WARNING, "cannot free structure");
65 >        objerror(op, WARNING, "cannot free structure");
66   #endif
67 <                return(0);
56 <        }
67 >        return(0);
68   }
69  
70  
71 < int
72 < free_objs(on, no)               /* free some object structures */
73 < register OBJECT on;
74 < OBJECT  no;
71 > extern int
72 > free_objs(              /* free some object structures */
73 >        register OBJECT on,
74 >        OBJECT  no
75 > )
76   {
77          int     nfreed;
78          register OBJREC *op;
# Line 74 | Line 86 | OBJECT no;
86   }
87  
88  
89 < free_objmem()                   /* free all object cache memory */
89 > extern void
90 > free_objmem(void)                       /* free all object cache memory */
91   {
92          free_objs(0, nobjects);
93          freedata(NULL);
81        freepict(NULL);
94          freefont(NULL);
95 +        SDfreeCache(NULL);
96   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines