/* Resource_list.c -- linked list implementation file */<br/> # include <stdio. h> <br/> # include <stdlib. h> <br/> # include "cmd_list.h" </P> <p>/* local function declaration */</P> <p> static cmd_list_node * make_node (const cmd_list_item Li1, const implements _list_item li2); </P> <p>/* interface function definition */</P> <p> int initialize_l (list * const PLI) <br/>{< br/> * PLI = NULL; </P> <p> return 1; <br/>}</P> <p> int isempty_l (const list * const PLI) <br/>{< br/> return NUL L = * PLI; <br/>}</P> <p> int insert_l (list * const PLI, const pai_list_item Li1, const pai_list_item li2) <br/>{< br/> pai_list_node * new_node; </P> <p> new_node = make_node (Li1, li2); <br/> If (null = new_node) <br/> return 0; <br/> new_node-> next = * PLI; <br/> * PLI = new_node; </P> <p> return 1; <br/>}</P> <p> int find_l (const list * const PLI, const pai_list_item Li1, const pai_l Ist_item li2) <br/>{< br/> pai_list_node * scan; </P> <p> scan = * PLI; <br/> while (SCAN) <br/>{< br/> If (Li1 = scan-> V & li2 = scan-> W) <br/> return 1; <br/> else <br/> scan = scan-> next; <br/>}</P> <p> return 0; <br/>}</P> <p> int delete_l (list * const PLI, const pai_list_item Li1, const pai_list_item li2) <br/> {<br/> pai_list_node * scan, * temp; </P> <p> If (isempty_l (PLI) <br/> Return 0; <br/> scan = * PLI; <br/>/* There is nly one node in the list and hit the target */<br/> If (null = scan-> next & Li1 = scan-> V & li2 = scan-> W) <br/>{< br/> free (SCAN); <br/> * PLI = NULL; <br/> return 1; <br/>}< br/> while (scan-> next & scan-> next-> V! = Li1 & scan-> next-> W! = Li2) <br/> scan = scan-> next; <br/> If (scan-> next) <br/> {<br/> temp = scan-> next; <br/> scan-> next = temp-> next; <br/> free (temp ); <br/> return 1; <br/>}< br/> else <br/> return 0; <br/>}</P> <p> void traversal_l (const list * const PLI, void (* pfun) (const pai_list_node * const PLN )) <br/> {<br/> pai_list_node * scan; </P> <p> scan = * PLI; <br/> while (SCAN) <br/>{< br/> (* pfun) (SCAN); <br/> scan = scan-> next; <br/>}</P> <p> void release_l (const list * const PLI) <br/>{< br/> pai_list_node * scan, * temp; </P> <p> scan = * PLI; <br/> while (SCAN) <br/> {<br/> temp = scan; <br/> scan = scan-> next; <br/> free (temp ); <br/>}</P> <p>/* local function definition */</P> <p> static performance_list_node * make_node (const performance_list_item Li1, const pai_list_item li2) <br/>{< br/> pai_list_node * new_node; </P> <p> new_node = (pai_list_node *) malloc (sizeof (pai_list_node )); <br/> If (null = new_node) <br/> return NULL; <br/> new_node-> V = Li1; <br/> new_node-> W = li2; </P> <p> return new_node; <br/>}