feat(utils): lists tests

This commit is contained in:
william.valenduc 2026-01-29 20:35:56 +00:00
parent e65c55f5c9
commit f0b39535fb
5 changed files with 310 additions and 5 deletions

View file

@ -121,7 +121,7 @@ int args_handler(int argc, char **argv, struct args_options *options,
}
args_in_var(vars, args_list);
list_destroy(args_list);
list_destroy(&args_list);
if (options->type == INPUT_UNDEFINED)
options->type = INPUT_STDIN;

View file

@ -31,7 +31,7 @@ void list_print(struct list *list);
** Release the memory used by the list.
** Does nothing if `list` is `NULL`.
*/
void list_destroy(struct list *list);
void list_destroy(struct list **list);
/*
** Release the memory used by the list and its content

View file

@ -49,9 +49,9 @@ void list_print(struct list *list)
}
}
void list_destroy(struct list *list)
void list_destroy(struct list **list)
{
struct list *elt = list;
struct list *elt = *list;
struct list *next_elt;
while (elt != NULL)
{
@ -59,6 +59,7 @@ void list_destroy(struct list *list)
free(elt);
elt = next_elt;
}
*list = NULL;
}
struct list *list_append(struct list *list, void *value)