feat(utils): lists tests
This commit is contained in:
parent
e65c55f5c9
commit
f0b39535fb
5 changed files with 310 additions and 5 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue