/*****************************************************************************/ /* */ /* UNIT: NTL1_Destroy_Header (Level 1 library routine) */ /* */ /* Author: Nikola Stojanovic */ /* */ /* Revision: 12 JUL 94 Version 1.0 */ /* */ /* Function: */ /* */ /* Procedure releases all memory space occupied by a header structure */ /* (containing data loaded from an alignment file); returns NULL as the */ /* proper new value for the destroyed header pointer */ /* */ /*****************************************************************************/ #include #include #include "ntl1.h" /*****************************************************************************/ header_ptr NTL1_Destroy_Header (header_ptr header) { int index; if (header == NULL) return NULL; else { if (header -> description != NULL) free (header -> description); if (header -> sequences != NULL) { for (index = 0; index < header -> dimension; index++) { if (((header -> sequences) [index]).seq_name != NULL) free (((header -> sequences) [index]).seq_name); if (((header -> sequences) [index]).alias != NULL) free (((header -> sequences) [index]).alias); } free (header -> sequences); } header -> generated = NTL1_Destroy_Blocks (header -> generated); header -> keywords = NTL1_Destroy_Blocks (header -> keywords); header -> alignments = NTL1_Destroy_Blocks (header -> alignments); free (header); return NULL; /* Returned value to be assigned to the destroyed header ptr */ } }