-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
30 lines (26 loc) · 1.16 KB
/
ft_lstnew.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gaaraujo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/11 08:32:48 by gaaraujo #+# #+# */
/* Updated: 2024/12/11 09:30:15 by gaaraujo ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
static bool allocate_node(t_list **node)
{
*node = (t_list *) malloc(sizeof(t_list));
return (*node != NULL);
}
t_list *ft_lstnew(void *content)
{
t_list *node;
if (!allocate_node(&node))
return (NULL);
node->content = content;
node->next = NULL;
return (node);
}