background image

  posnode = list_entry((&(p)->list_name)->next, type, list_name);
  list_del((&(p)->list_name)->next);
  free(posnode);
  }
  }
  /**
  * 通用链表实现部分
  */
  static  void __list_add(struct list_head * new, struct list_head * prev, struct list_head * next)
  {
  next->prev = new;
  new->next = next;
  new->prev = prev;
  prev->next = new;
  }
  static  void list_add(struct list_head *new, struct list_head *head)
  {
  __list_add(new, head, head->next);
  }
  static  void list_add_tail(struct list_head *new, struct list_head *head)
  {
  __list_add(new, head->prev, head);
  }
  static  void __list_del(struct list_head * prev, struct list_head * next)
  {
  next->prev = prev;
  prev->next = next;
  }
  static  void list_del(struct list_head *entry)
  {
  __list_del(entry->prev, entry->next);
  }
  static  void list_del_init(struct list_head *entry)
  {
  __list_del(entry->prev, entry->next);
  INIT_LIST_HEAD(entry);
  }
  static  int list_empty(struct list_head *head)
  {
  return head->next == head;
  }
  static  void list_splice(struct list_head *list, struct list_head *head)
  {
  struct list_head *first = list->next;