diff options
Diffstat (limited to 'queue.c')
| -rw-r--r-- | queue.c | 14 |
1 files changed, 14 insertions, 0 deletions
| @@ -63,6 +63,17 @@ queue_empty(struct queue *queue) | |||
| 63 | return queue->head == NULL; | 63 | return queue->head == NULL; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void | ||
| 67 | queue_free(struct queue *queue) | ||
| 68 | { | ||
| 69 | struct queue_item *item, *next; | ||
| 70 | |||
| 71 | for ( item = queue->head; item; item = next ) { | ||
| 72 | next = item->next; | ||
| 73 | free(item); | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 66 | int | 77 | int |
| 67 | main() | 78 | main() |
| 68 | { | 79 | { |
| @@ -80,5 +91,8 @@ main() | |||
| 80 | else | 91 | else |
| 81 | ERROR("this shouldn't happen!"); | 92 | ERROR("this shouldn't happen!"); |
| 82 | } | 93 | } |
| 94 | |||
| 95 | queue_free(queue); | ||
| 96 | |||
| 83 | return EXIT_SUCCESS; | 97 | return EXIT_SUCCESS; |
| 84 | } | 98 | } |
