/* --------------------------------------------------------------
FUNCTION GET_FREE_NODE: The steps to get a node from the free node
list are:
A. If the free node list is empty, get memory for a new node and
return its address.
B. Else remove the first node from the free list and use that.
------------------------------------------------------------- */
Node *get_free_node(void)
{
const Node *pnew_node;
/*A*/ if (pfree_node == NULL) {
pnew_node = malloc(sizeof(Node));
}
/*B*/ else {
pnew_node = pfree_node;
pfree_node = pfree_node->pfwd;
}
return pnew_node;
}
/* ----------------------------------------------------------- */
/* End of File */