Changeset 420 for trunk/Jgraph/list.c
- Timestamp:
- 02/27/08 07:13:31 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Jgraph/list.c
r418 r420 7 7 8 8 #include <stdio.h> /* Basic includes and definitions */ 9 #include <stdlib.h> 9 10 #include "list.h" 10 11 … … 33 34 } *Int_list; 34 35 35 insert(item, list) /* Inserts to the end of a list */ 36 List item; 37 List list; 36 void insert(void *item, void *list) /* Inserts to the end of a list */ 38 37 { 39 38 List last_node; 40 39 41 last_node = list->blink;40 last_node = ((List)list)->blink; 42 41 43 list->blink = item;42 ((List)list)->blink = item; 44 43 last_node->flink = item; 45 item->blink = last_node;46 item->flink = list;44 ((List)item)->blink = last_node; 45 ((List)item)->flink = list; 47 46 } 48 47 49 delete_item(item) /* Deletes an arbitrary iterm */ 50 List item; 48 void delete_item(void *item) /* Deletes an arbitrary iterm */ 51 49 { 52 item->flink->blink = item->blink;53 item->blink->flink = item->flink;50 ((List)item)->flink->blink = ((List)item)->blink; 51 ((List)item)->blink->flink = ((List)item)->flink; 54 52 } 55 53 … … 68 66 } 69 67 70 List get_node(list) /* Allocates a node to be inserted into the list */ 71 List list; 68 List get_node(void *list) /* Allocates a node to be inserted into the list */ 72 69 { 73 70 Int_list l; … … 84 81 } 85 82 86 free_node(node, list) /* Deallocates a node from the list */ 87 List node; 88 List list; 83 void free_node(void *node, void *list) /* Deallocates a node from the list */ 89 84 { 90 85 Int_list l; 91 86 92 87 l = (Int_list) list; 93 node->flink = l->free_list;88 ((List)node)->flink = l->free_list; 94 89 l->free_list = node; 95 90 }
Note:
See TracChangeset
for help on using the changeset viewer.