diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:20:05 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:20:05 +0200 |
| commit | 3b27def26196cc96fe14fc8333d9e66189d6230f (patch) | |
| tree | 3b1c1d0e0d4a924cbd605ed99a339dbb3218c5c4 /graphs/piscine/evalexpr/src/fifo_setup_destroy.c | |
| parent | 73c2b00a10c5786ddeeacc915e233fd4df1c9321 (diff) | |
Diffstat (limited to 'graphs/piscine/evalexpr/src/fifo_setup_destroy.c')
| -rw-r--r-- | graphs/piscine/evalexpr/src/fifo_setup_destroy.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/graphs/piscine/evalexpr/src/fifo_setup_destroy.c b/graphs/piscine/evalexpr/src/fifo_setup_destroy.c deleted file mode 100644 index 0f99ad0..0000000 --- a/graphs/piscine/evalexpr/src/fifo_setup_destroy.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <stdlib.h> - -#include "fifo.h" - -struct fifo *fifo_init(void) -{ - struct fifo *f = malloc(sizeof(struct fifo)); - if (f == NULL) - { - return NULL; - } - - f->size = 0; - f->head = NULL; - f->tail = NULL; - - return f; -} - -void fifo_clear(struct fifo *fifo) -{ - for (struct list *l = fifo->head; l != fifo->tail;) - { - struct list *tmp = l->next; - free(l->data); - free(l); - l = tmp; - } - if (fifo->tail) - { - free(fifo->tail->data); - free(fifo->tail); - } - - fifo->head = NULL; - fifo->tail = NULL; - fifo->size = 0; -} - -void fifo_destroy(struct fifo *fifo) -{ - fifo_clear(fifo); - free(fifo); -} |
