コード例 #1
0
ファイル: dllist.c プロジェクト: nask0/calipso
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;
}
コード例 #2
0
ファイル: chunks.c プロジェクト: rkarpuzov/calipso
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);
    }
}
コード例 #3
0
ファイル: pilot.c プロジェクト: 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);
}