diff options
| author | Thomas Schmucker <ts@its1.de> | 2020-08-06 09:09:01 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2020-08-06 09:09:01 +0200 |
| commit | 0dbae9bb1846ea279bc1c97f03f4499d5ac4490e (patch) | |
| tree | 0a00bd31f9c712b70c1b6794d0317dd2e6532a15 /queue.c | |
| parent | 5c2c4fa6d5f72c127d99a5a2952b3b3e39cadc40 (diff) | |
| download | data-structures-0dbae9bb1846ea279bc1c97f03f4499d5ac4490e.tar.gz data-structures-0dbae9bb1846ea279bc1c97f03f4499d5ac4490e.tar.bz2 data-structures-0dbae9bb1846ea279bc1c97f03f4499d5ac4490e.zip | |
Fix: queue_free() hinzugefügt
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 | } |
