Constraint_list *free_constraint_list4lib_computation (Constraint_list *CL) { if (!CL)return NULL; free_arrayN(CL->residue_index, 3); free_int (CL->M, -1); vfree (CL); return CL; }
void * free_arrayN(void *p, int n) { int a, s; void **i; if ( p==NULL) return NULL; else if ( n==1)vfree ((void *)p); else { i=(void**)p; s=read_array_size ( (void *)p, sizeof ( void *)); for ( a=0; a< s; a++)free_arrayN ((void *)i[a], n-1); vfree (p); } return NULL; }
void free_sequence ( Sequence *LS, int nseq) { if ( !LS) return; free_char ( LS->file, -1); free_char ( LS->seq_comment, -1); free_char ( LS->aln_comment, -1); free_char ( LS->seq, -1); free_char ( LS->name,-1); free_int (LS->dc, -1); free_arrayN((void*)LS->T, 2); vfree (LS->type); vfree (LS->len); free_weights (LS->W); //Don't free LS->blastdb; vfree (LS); }
Sequence *free_constraint_list (Constraint_list *CL) { Sequence *S; int a, b; Constraint_list *pCL; /*Prepare the selective freeing of the CL data structure: If the CL has been obtained from copy, every pointer that is identical to the parent CL (CL->pCL) will not be saved. */ if ( !CL)return NULL; else S=CL->S; if ( CL->copy_mode==SOFT_COPY && !CL->pCL) {vfree(CL); return S;} else if ( CL->copy_mode==SOFT_COPY) { pCL=CL->pCL; CL->residue_index=NULL; if ( CL->M ==pCL->M )CL->M=NULL; if (CL->start_index ==pCL->start_index )CL->start_index=NULL; if (CL->end_index ==pCL->end_index )CL->end_index=NULL; if ( CL->fp ==pCL->fp )CL->fp=NULL; if ( CL->matrices_list ==pCL->matrices_list )CL->matrices_list=NULL; if ( CL->STRUC_LIST ==pCL->STRUC_LIST )CL->STRUC_LIST=NULL; if ( CL->W ==pCL->W )CL->W=NULL; if ( CL->DM ==pCL->DM )CL->DM=NULL; if ( CL->ktupDM ==pCL->ktupDM )CL->ktupDM=NULL; if ( CL->translation ==pCL->translation )CL->translation=NULL; if ( CL->moca ==pCL->moca )CL->moca=NULL; if ( CL->Prot_Blast ==pCL->Prot_Blast )CL->Prot_Blast=NULL; if ( CL->DNA_Blast ==pCL->DNA_Blast )CL->DNA_Blast=NULL; if ( CL->Pdb_Blast ==pCL->Pdb_Blast )CL->Pdb_Blast=NULL; if ( CL->seq_for_quadruplet ==pCL->seq_for_quadruplet )CL->seq_for_quadruplet=NULL; if ( CL->TC ==pCL->TC )CL->TC=NULL; } /*End of selective freeing of the CL data structure*/ if ( CL->residue_index)free_arrayN(CL->residue_index, 3); if ( CL->M)free_int (CL->M, -1); if ( CL->fp)vfclose (CL->fp); if ( CL->matrices_list)free_char(CL->matrices_list,-1); if ( CL->start_index)free_int ( CL->start_index,-1); if ( CL->end_index)free_int ( CL->end_index,-1); if ( CL->STRUC_LIST)free_sequence ( CL->STRUC_LIST, (CL->STRUC_LIST)->nseq); if ( CL->W)free_weights (CL->W); CL->DM=free_distance_matrix (CL->DM); CL->ktupDM=free_distance_matrix (CL->ktupDM); if ( CL->translation)vfree(CL->translation); if ( CL->moca)free_moca (CL->moca); if ( CL->Prot_Blast)free_blast_param ( CL->Prot_Blast); if ( CL->DNA_Blast) free_blast_param ( CL->DNA_Blast); if ( CL->Pdb_Blast) free_blast_param ( CL->Pdb_Blast); if ( CL->TC) free_TC_param ( CL->TC); if (CL->seq_for_quadruplet)vfree (CL->seq_for_quadruplet); vfree(CL); return S; }