Exemple #1
0
// Clear the module’s list of Elements, freeing memory as appropriate.
void Module_clear(Module *md) {
  Element *p,*q;
  p = md->head;
  while (p) {
    q = p;
    p = p->next;
    Element_delete(q);
  }
}
void List_deepDelete(List_t self, void Element_delete(void * element)){
    if(NULL == self) return;

    for(int i = 0; i < self->size; i++){
        Element_delete(self->array[i]);
    }
    free(self->array);
    free(self);
}