예제 #1
0
파일: acvent.c 프로젝트: kevintom/quora
void destroy_list(struct LList* list){
    while(list->count > 0){
        struct LLNode* node = pop(list);
        destroy_llnode(node);
    }
    free(list);
    list = NULL;
}
예제 #2
0
파일: list.c 프로젝트: axelhellman/Lager2.0
void destroy_list(list* l)
{
  if (l == NULL)
    {
      puts("l är null");
      return;
    }
  linked_list_node* ll_node = l -> ll_first;
  linked_list_node* tmp_ll_node = NULL;
  while (ll_node != NULL)
    {
      tmp_ll_node = ll_node;
      ll_node = ll_node -> next_node;
      destroy_llnode(tmp_ll_node);
    } 
  if (l != NULL)
    free(l);
}
예제 #3
0
파일: list.c 프로젝트: axelhellman/Lager2.0
void remove_shelf(node* n, shelf* shelf)
{
  list* l = get_list(n);
  linked_list_node* prev = get_prev_node(l, shelf);
  linked_list_node* remove;
  if (prev == NULL)
    {
      remove = l -> ll_first;
      l -> ll_first = remove -> next_node;
    }
  else
    {    
      remove = prev -> next_node;
      linked_list_node* next = remove -> next_node;
      prev -> next_node = next;
    }
  int r_amount = get_shelf_amount2(remove);
  l -> total = l -> total - r_amount;
  destroy_llnode(remove);
}