1 |
#ifndef lint |
2 |
static const char RCSid[] = "$Id: free_os.c,v 3.2 2003/02/25 02:47:21 greg Exp $"; |
3 |
#endif |
4 |
/* |
5 |
* Free memory associated with object(s) |
6 |
* |
7 |
* External symbols declared in object.h |
8 |
*/ |
9 |
|
10 |
#include "copyright.h" |
11 |
|
12 |
#include "standard.h" |
13 |
#include "octree.h" |
14 |
#include "object.h" |
15 |
#include "otypes.h" |
16 |
#include "face.h" |
17 |
#include "cone.h" |
18 |
#include "instance.h" |
19 |
|
20 |
|
21 |
int |
22 |
free_os(op) /* free unneeded memory for object */ |
23 |
register OBJREC *op; |
24 |
{ |
25 |
if (op->os == NULL) |
26 |
return(0); |
27 |
switch (op->otype) { |
28 |
case OBJ_FACE: /* polygon */ |
29 |
freeface(op); |
30 |
return(1); |
31 |
case OBJ_CONE: /* cone */ |
32 |
case OBJ_RING: /* disk */ |
33 |
case OBJ_CYLINDER: /* cylinder */ |
34 |
case OBJ_CUP: /* inverted cone */ |
35 |
case OBJ_TUBE: /* inverted cylinder */ |
36 |
freecone(op); |
37 |
return(1); |
38 |
case OBJ_INSTANCE: /* octree instance */ |
39 |
freeinstance(op); |
40 |
return(1); |
41 |
case OBJ_MESH: /* mesh instance */ |
42 |
freemeshinst(op); |
43 |
return(1); |
44 |
} |
45 |
/* don't really know */ |
46 |
free((void *)op->os); |
47 |
op->os = NULL; |
48 |
return(1); |
49 |
} |