From 88f29720d2a09eaef81ad3646169d6bc19be8bfb Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 6 Feb 2020 00:28:25 +0100 Subject: Added ft_list_size and ft_list_push_front test --- functions_reference/ref_ft_list_push_front.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'functions_reference/ref_ft_list_push_front.c') diff --git a/functions_reference/ref_ft_list_push_front.c b/functions_reference/ref_ft_list_push_front.c index 821247d..22ca4a9 100644 --- a/functions_reference/ref_ft_list_push_front.c +++ b/functions_reference/ref_ft_list_push_front.c @@ -3,9 +3,12 @@ void ref_ft_list_push_front(t_list **begin_list, void *data) { - - if (begin_list == NULL || data == NULL) + if (begin_list == NULL) + return ; + t_list *new = malloc(sizeof(t_list)); + if (new == NULL) return ; - data->next = *begin_list; - *begin_list = data; + new->data = data; + new->next = *begin_list; + *begin_list = new; } -- cgit