diff options
Diffstat (limited to 'libft')
-rw-r--r-- | libft/Makefile | 1 | ||||
-rw-r--r-- | libft/inc/libft.h | 1 | ||||
-rw-r--r-- | libft/src/ft_delwords.c | 28 |
3 files changed, 30 insertions, 0 deletions
diff --git a/libft/Makefile b/libft/Makefile index ec87186..398e29b 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -81,6 +81,7 @@ SRCS_NAME += ft_uintlen.c SRCS_NAME += ft_uintlen_base.c SRCS_NAME += ft_nstr.c SRCS_NAME += ft_memdel.c +SRCS_NAME += ft_delwords.c SRCS_NAME += ft_kernel_panic.c SRCS_NAME += get_next_line.c SRCS_NAME += get_next_line_utils.c diff --git a/libft/inc/libft.h b/libft/inc/libft.h index 843e97c..f85f4b3 100644 --- a/libft/inc/libft.h +++ b/libft/inc/libft.h @@ -75,6 +75,7 @@ void ft_kernel_panic(void); void ft_putnbr(long nb); void ft_putnbr_base(long nb, char *base); void ft_memdel(void **ptr); +void ft_delwords(char **words); void *ft_memset(void *b, int c, size_t len); void *ft_memcpy(void *dst, const void *src, size_t n); void *ft_memccpy(void *dst, const void *src, diff --git a/libft/src/ft_delwords.c b/libft/src/ft_delwords.c new file mode 100644 index 0000000..79c671d --- /dev/null +++ b/libft/src/ft_delwords.c @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_delwords.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <stddef.h> + +void + ft_delwords(char **words) +{ + size_t i; + + i = 0; + while (words[i]) + { + ft_memdel((void*)&words[i]); + i++; + } + ft_memdel((void*)&words); +} |