/*****************************************************************************/ /* */ /* UNIT: NTL1_Destroy_IMDfile (Level 1 library routine) */ /* */ /* Author: Nikola Stojanovic */ /* */ /* Revision: 07 MAY 96 Version 1.0 */ /* */ /* Function: */ /* */ /* Procedure releases all memory space occupied by a list of motifs */ /* loaded from the Information Matrix Database file; returns NULL as the */ /* proper new value for the destroyed list head pointer */ /* */ /*****************************************************************************/ #include #include #include "ntl1.h" /*****************************************************************************/ imd_ptr NTL1_Destroy_IMDlist (imd_ptr motif_list) { imd_ptr current, scan; int index; scan = motif_list; while (scan != NULL) { current = scan; scan = scan -> next; if (current -> file_name != NULL) free (current -> file_name); if (current -> site_name != NULL) free (current -> site_name); if (current -> bind_factor != NULL) free (current -> bind_factor); if (current -> sequence != NULL) free (current -> sequence); if (current -> matrix != NULL) { for (index = 0; index < current -> seq_length; index++) { if ((current -> matrix) [index] != NULL) free ((current -> matrix) [index]); } free (current -> matrix); } if (current -> reference != NULL) free (current -> reference); free (current); } return NULL; }