diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:19:00 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-10-11 22:19:00 +0200 |
| commit | 73c2b00a10c5786ddeeacc915e233fd4df1c9321 (patch) | |
| tree | e299ea4e8ac161b2b21170172ff8f182c1c3fe1a /rushs/tinyprintf/generic_void_list | |
| parent | c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c (diff) | |
fix: evalexpr & tinyprintf contenaient toute la piscine
Diffstat (limited to 'rushs/tinyprintf/generic_void_list')
| -rw-r--r-- | rushs/tinyprintf/generic_void_list/list.c | 36 | ||||
| -rw-r--r-- | rushs/tinyprintf/generic_void_list/list.h | 31 |
2 files changed, 0 insertions, 67 deletions
diff --git a/rushs/tinyprintf/generic_void_list/list.c b/rushs/tinyprintf/generic_void_list/list.c deleted file mode 100644 index 20ecfa8..0000000 --- a/rushs/tinyprintf/generic_void_list/list.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "list.h" - -#include <stdlib.h> -#include <string.h> - -struct list *list_prepend(struct list *list, const void *value, - size_t data_size) -{ - struct list *new = malloc(sizeof(struct list)); - new->next = list; - new->data = malloc(sizeof(void *)); - memcpy(new->data, value, data_size); - return new; -} - -size_t list_length(struct list *list) -{ - size_t res = 0; - while (list) - { - res++; - list = list->next; - } - return res; -} - -void list_destroy(struct list *list) -{ - while (list) - { - struct list *tmp = list->next; - free(list->data); - free(list); - list = tmp; - } -} diff --git a/rushs/tinyprintf/generic_void_list/list.h b/rushs/tinyprintf/generic_void_list/list.h deleted file mode 100644 index a1bc035..0000000 --- a/rushs/tinyprintf/generic_void_list/list.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef LIST_H -#define LIST_H - -#include <stddef.h> - -struct list -{ - void *data; - struct list *next; -}; - -/* -** Insert a node containing `value` at the beginning of the list. -** Return `NULL` if an error occurred. -*/ -struct list *list_prepend(struct list *list, const void *value, - size_t data_size); - -/* -** Return the length of the list. -** Return `0` if the list is empty. -*/ -size_t list_length(struct list *list); - -/* -** Release the memory used by the list. -** Does nothing if `list` is `NULL`. -*/ -void list_destroy(struct list *list); - -#endif /* !LIST_H */ |
