libft
Functions
ft_lstnew.c File Reference
#include "libft.h"
#include <stdlib.h>
+ Include dependency graph for ft_lstnew.c:

Go to the source code of this file.

Functions

t_listft_lstnew (void const *content, size_t content_size)
 Allocates a new list. More...
 

Function Documentation

◆ ft_lstnew()

t_list* ft_lstnew ( void const *  content,
size_t  content_size 
)

Allocates a new list.

Allocates (with malloc) and returns a “fresh” link. The variables content and content_size of the new link are initialized by copy of the parameters of the function. If the parameter content is NULL, the variable content is initialized to NULL and the variable content_size is initialized to 0 even if the parameter content_size isn’t. The variable next is initialized to NULL.

Parameters
contentThe content to put in the new link.
content_sizeThe size of the content of the new link.
Returns
The new link, or NULL if allocation fails.

Definition at line 31 of file ft_lstnew.c.