Ejemplo n.º 1
0
Archivo: stack.c Proyecto: DRiKE/bspwm
void stack_insert_before(stacking_list_t *a, node_t *n)
{
	stacking_list_t *s = make_stack(n);
	if (a == NULL) {
		stack_head = stack_tail = s;
	} else {
		if (a->node == n)
			return;
		remove_stack_node(n);
		stacking_list_t *b = a->prev;
		if (b != NULL)
			b->next = s;
		s->prev = b;
		s->next = a;
		a->prev = s;
		if (stack_head == a)
			stack_head = s;
	}
}
Ejemplo n.º 2
0
void stack_insert_after(stacking_list_t *a, node_t *n)
{
    stacking_list_t *s = make_stack(n);
    if (a == NULL) {
        stack_head = stack_tail = s;
    } else {
        if (a->node == n) {
            free(s);
            return;
        }
        remove_stack_node(n);
        stacking_list_t *b = a->next;
        if (b != NULL)
            b->prev = s;
        s->next = b;
        s->prev = a;
        a->next = s;
        if (stack_tail == a)
            stack_tail = s;
    }
}