Exemplo n.º 1
0
Arquivo: clist.c Projeto: texane/eyed
static void clist_swap_nodes(clist_t* list,
			     clist_node_t* node_a,
			     clist_node_t* node_b)
{
  clist_node_t* pos_a;
  clist_node_t* pos_b;

  /* neighbors */
  if (node_a->next == node_b)
    {
      clist_unlink_node(list, node_a);
      clist_insert_after(list, node_b, node_a);
      return ;
    }
  else if (node_b->next == node_a)
    {
      clist_unlink_node(list, node_b);
      clist_insert_after(list, node_a, node_b);
      return ;
    }

  /* get posistions */
  pos_a = clist_node_next(node_b);
  pos_b = clist_node_next(node_a);

  /* unlink nodes */
  clist_unlink_node(list, node_a);
  clist_unlink_node(list, node_b);

  /* insert nodes */
  clist_insert_before(list, pos_a, node_a);
  clist_insert_before(list, pos_b, node_b);
}
Exemplo n.º 2
0
Arquivo: clist.c Projeto: Mortal/claws
int clist_prepend(clist * lst, void * data) {
  return clist_insert_before(lst, lst->first, data);
}