Ejemplo n.º 1
0
int		rm_elem(t_piece **list)
{
  t_piece	*tmp;
  t_piece	*tmp2;
  int		i;
  bool		first;

  i = 0;
  while (*list != NULL && (*list)->valid == false)
    rm_first_elem(list, &i);
  if ((tmp = (*list)) == NULL)
    return (- 1);
  first = true;
  while (tmp != *list || first == true)
    if (tmp->next->valid == false)
      {
	tmp2 = tmp->next;
	tmp->next = tmp2->next;
	free_piece(tmp2);
	i++;
      }
    else
      {
	tmp = tmp->next;
	first = false;
      }
  return (i);
}
Ejemplo n.º 2
0
void		pa(t_psw *psw, int v)
{
  int		nb;

  my_putstr("pa");
  nb = psw->rootb->next->val;
  add_elem_beg(nb, psw->roota);
  rm_first_elem(psw->rootb);
  if (v == 1)
    show_v(psw);
}