Ejemplo n.º 1
0
int dll_free_list(DLL_NODE_PTR head)
{
	DLL_NODE_PTR node = NULL;
	int count = 0;

	FF_VALIDATE(head);
	if (head == NULL)
		return(0);
	
	dll_rewind(&head);

	node = dll_first(head);
	while (!DLL_IS_HEAD_NODE(node))
	{
		dll_delete_node(node);

		count++;
		node = dll_first(head);
	}

#ifdef DLL_CHK
	assert(DLL_COUNT(head) == 0);
#endif

	head->next = head->previous = NULL;

#ifdef FF_CHK_ADDR
	head->check_address = NULL;
#endif

	memFree(head, "Header Node");          

	return(count);
}
Ejemplo n.º 2
0
DLL_NODE_PTR dll_add(DLL_NODE_PTR head_node)
{
	dll_rewind(&head_node);

	return(dll_insert(head_node));
/*
#ifdef DLL_CHK
	DLL_NODE_PTR new_node = dll_node_create(head_node);
#else
	DLL_NODE_PTR new_node = dll_node_create();
#endif
	
	FF_VALIDATE(head_node);
	
	if (new_node == NULL)
		return(NULL);

	dll_previous(new_node) = head_node;
	dll_next(new_node) = dll_next(head_node);

	dll_previous(dll_next(new_node)) = new_node;
	dll_next(head_node) = new_node;

	return(new_node);
*/
}
Ejemplo n.º 3
0
DLL_NODE_PTR dll_last(DLL_NODE_PTR node)
{
	FF_VALIDATE(node);

	dll_rewind(&node);

	return(node->previous);
}
Ejemplo n.º 4
0
DLL_NODE_PTR dll_first(DLL_NODE_PTR node)
{
	FF_VALIDATE(node);

	dll_rewind(&node);

	return(node->next);
}
Ejemplo n.º 5
0
void __wrap_rewind(FILE *stream)
{
  dll_rewind(stream);
}