Ticket #36397: patch-list.c.diff
File patch-list.c.diff, 1.6 KB (added by stevecheckoway (Stephen Checkoway), 12 years ago) |
---|
-
list.c
old new 6 6 */ 7 7 8 8 #include <stdio.h> /* Basic includes and definitions */ 9 #include <stdlib.h> 9 10 #include "list.h" 10 11 11 12 #define boolean int … … typedef struct int_list { /* Informatio 32 33 List free_list; 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 { 38 List item = item_; 39 List list = list_; 39 40 List last_node; 40 41 41 42 last_node = list->blink; … … List list; 46 47 item->flink = list; 47 48 } 48 49 49 delete_item(item) /* Deletes an arbitrary iterm */ 50 List item; 50 void delete_item(void *item_) /* Deletes an arbitrary iterm */ 51 51 { 52 List item = item_; 52 53 item->flink->blink = item->blink; 53 54 item->blink->flink = item->flink; 54 55 } 55 56 56 List make_list(size) /* Creates a new list */ 57 int size; 57 List make_list(int size) /* Creates a new list */ 58 58 { 59 59 Int_list l; 60 60 … … int size; 67 67 return (List) l; 68 68 } 69 69 70 List get_node(list) /* Allocates a node to be inserted into the list */ 71 List list; 70 List get_node(void *list_) /* Allocates a node to be inserted into the list */ 72 71 { 72 List list = list_; 73 73 Int_list l; 74 74 List to_return; 75 75 … … List list; 83 83 } 84 84 } 85 85 86 free_node(node, list) /* Deallocates a node from the list */ 87 List node; 88 List list; 86 void free_node(void *node_, void *list_) /* Deallocates a node from the list */ 89 87 { 88 List node = node_; 89 List list = list_; 90 90 Int_list l; 91 91 92 92 l = (Int_list) list;