Ejemplo n.º 1
0
/* Function:  free_EstEvidence(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 [EstEvidence *]
 *
 * Return [UNKN ]  Undocumented return value [EstEvidence *]
 *
 */
EstEvidence * free_EstEvidence(EstEvidence * obj) 
{
    int return_early = 0;    
    int i;   


    if( obj == NULL) {  
      warn("Attempting to free a NULL pointer to a EstEvidence 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->exon != NULL)   {  
      for(i=0;i<obj->len;i++)    {  
        if( obj->exon[i] != NULL)    
          free_EstExon(obj->exon[i]);    
        }  
      ckfree(obj->exon); 
      }  
    if( obj->indel != NULL)  {  
      for(i=0;i<obj->indel_len;i++)  {  
        if( obj->indel[i] != NULL)   
          free_EstIndel(obj->indel[i]);  
        }  
      ckfree(obj->indel);    
      }  
    if( obj->ct != NULL) 
      free_CodonTable(obj->ct);  


    ckfree(obj); 
    return NULL; 
}    
Ejemplo n.º 2
0
boolean free_io_objects(void)
{
  if( use_tsm == TRUE) {
    free_ThreeStateModel(tsm);
  } else {
    free_Protein(pro);
  }

  free_CodonTable(ct);
  if( gf != NULL ) {
    free_GeneFrequency21(gf);
  }
  free_RandomModelDNA(rmd);
  if( is_embl ) {
    free_GenomicRegion(embl);
  } 
  free_Genomic(gen);
  

  return TRUE;
}
Ejemplo n.º 3
0
/* Function:  free_CodonMapper(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 [CodonMapper *]
 *
 * Return [UNKN ]  Undocumented return value [CodonMapper *]
 *
 */
CodonMapper * free_CodonMapper(CodonMapper * obj) 
{


    if( obj == NULL) {  
      warn("Attempting to free a NULL pointer to a CodonMapper obj. Should be trappable");   
      return NULL;   
      }  


    if( obj->dynamite_hard_link > 1)     {  
      obj->dynamite_hard_link--; 
      return NULL;   
      }  
    if( obj->ct != NULL) 
      free_CodonTable(obj->ct);  


    ckfree(obj); 
    return NULL; 
}