Example #1
0
/*
int printQueue(queue q, printFn f)
{
	int cnt = q->size - 1;
	node * n = NULL;
	void * content[q->size];
	
	assert(q);
	if (!f) return -1;
	
	for(n = q->head; n != NULL; n = n->prev)
	{
		content[cnt] = n->e;
		cnt--;
	}
	for(cnt = 0; cnt < q->size; ++cnt)
	{
		printf(" %d:", cnt+1);
		f(content[cnt]);
	}	
	printf("\n");
	
	return 0;
}
*/
void deleteQueue(queue q)
{
	assert(q);
	node * n = q->head;
	node * prev = NULL;
	while(n != NULL)
	{
		prev = n->prev;
    if (q->df) q->df(n->e);
		deleteNode(n);
		n = prev;
	}
	free(q);
}