void free_objects(void) { if( gwdb != NULL ) gwdb = free_GeneWiseDB(gwdb); if( cdb != NULL ) cdb = free_cDNADB(cdb); if( sdb != NULL ) sdb = free_SequenceDB(sdb); if( cdna != NULL ) cdna = free_cDNA(cdna); if( pro != NULL ) pro = free_Protein(pro); if( tsm != NULL ) tsm = free_ThreeStateModel(tsm); if( tsmdb != NULL ) tsmdb = free_ThreeStateDB(tsmdb); if( gws != NULL ) gws = free_GeneWiseScore(gws); if( hs != NULL ) hs = free_Hscore(hs); if( cm != NULL ) cm = free_CodonMapper(cm); if( cps != NULL ) cps = free_cDNAParser(cps); }
/* Function: free_GenePhaseScore(obj) * * Descrip: Free Function: removes the memory held by obj * Will chain up to owned members and clear all lists * * * Arg: obj [UNKN ] Object that is free'd [GenePhaseScore *] * * Return [UNKN ] Undocumented return value [GenePhaseScore *] * */ GenePhaseScore * free_GenePhaseScore(GenePhaseScore * obj) { int return_early = 0; int i; if( obj == NULL) { warn("Attempting to free a NULL pointer to a GenePhaseScore obj. Should be trappable"); return NULL; } #ifdef PTHREAD assert(pthread_mutex_lock(&(obj->dynamite_mutex)) == 0); #endif if( obj->dynamite_hard_link > 1) { return_early = 1; obj->dynamite_hard_link--; } #ifdef PTHREAD assert(pthread_mutex_unlock(&(obj->dynamite_mutex)) == 0); #endif if( return_early == 1) return NULL; if( obj->phase != NULL) { for(i=0;i<obj->len;i++) { if( obj->phase[i] != NULL) free_GenePhaseSegScore(obj->phase[i]); } ckfree(obj->phase); } if( obj->gws != NULL) free_GeneWiseScore(obj->gws); ckfree(obj); return NULL; }