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