Exemplo n.º 1
0
dllist_t *dllist_insert_before(dllist_t *l, void *d, void * pos)
{
	dllist_t *newNode =NULL,*runNode = l;

	newNode = dllist_new(d);

	if(l == NULL) return newNode; 

	runNode = dllist_find(l, pos);

	if(runNode == NULL) 
	{
		_dllist_release(newNode);
		return l;
	} 

	if(runNode->prev == NULL)
	{	//insert head node
		runNode->prev = newNode;
		newNode->next = runNode;
		l = newNode;
	} 
	else 
	{
		newNode->next = runNode;
		newNode->prev = runNode->prev;
		runNode->prev = newNode;
		newNode->prev->next = newNode; 
	}
	
	return l;
}
Exemplo n.º 2
0
void chunks_remove_data(chunks_t *c, struct chunk_ctx * ctx)
{
    dllist_t *l = dllist_find(c->list, ctx);

    if (l) {
        c->total_bytes -= ctx->size;
        c->list = dllist_find_release(l, ctx);
    }
}
Exemplo n.º 3
0
Arquivo: pilot.c Projeto: callaa/luola
/* Remove a pilot from the level */
void remove_pilot(struct Pilot *pilot) {
    struct dllist *lst = dllist_find(pilot_list,pilot);

    pilot_detach_rope(pilot);

    if(lst==pilot_list)
        pilot_list = dllist_remove(lst);
    else
        dllist_remove(lst);
}