aboutsummaryrefslogtreecommitdiff
path: root/queue.c
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-08-06 09:09:01 +0200
committerThomas Schmucker <ts@its1.de>2020-08-06 09:09:01 +0200
commit0dbae9bb1846ea279bc1c97f03f4499d5ac4490e (patch)
tree0a00bd31f9c712b70c1b6794d0317dd2e6532a15 /queue.c
parent5c2c4fa6d5f72c127d99a5a2952b3b3e39cadc40 (diff)
downloaddata-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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/queue.c b/queue.c
index c8ec31e..e26acbb 100644
--- a/queue.c
+++ b/queue.c
@@ -63,6 +63,17 @@ queue_empty(struct queue *queue)
63 return queue->head == NULL; 63 return queue->head == NULL;
64} 64}
65 65
66void
67queue_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
66int 77int
67main() 78main()
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}