diff --git a/Makefile b/Makefile index e1353ec..11e6bda 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ MEMSRC = \ bzero \ calloc \ memchr \ + memclear \ memcmp \ memcpy \ memmove \ diff --git a/README.md b/README.md index 49f34a5..474037d 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,3 @@ TODOs: 1. Add get_next_line 2. Add ft_printf 3. Error management for the functions. -4. Add a free function for ft_split. diff --git a/includes/libft.h b/includes/libft.h index 2732aeb..6618cc8 100644 --- a/includes/libft.h +++ b/includes/libft.h @@ -6,7 +6,7 @@ /* By: myeow +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/15 16:11:56 by myeow #+# #+# */ -/* Updated: 2024/04/05 19:04:15 by myeow ### ########.fr */ +/* Updated: 2024/04/05 20:29:48 by myeow ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,6 +15,7 @@ # include +void ft_memclear(void *content); char *ft_strendptr(char *str); int ft_isspace(int c); int ft_isalpha(int c); diff --git a/srcs/mem_utils/ft_memclear.c b/srcs/mem_utils/ft_memclear.c new file mode 100644 index 0000000..681aa37 --- /dev/null +++ b/srcs/mem_utils/ft_memclear.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memclear.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: myeow +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/04/05 20:26:45 by myeow #+# #+# */ +/* Updated: 2024/04/05 20:30:52 by myeow ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +/* + * Pair this with ft_lstclear. + */ +void ft_memclear(void *content) +{ + free(content); + return ; +} diff --git a/srcs/str_utils/ft_split.c b/srcs/str_utils/ft_split.c index 2a9498a..7b7b187 100644 --- a/srcs/str_utils/ft_split.c +++ b/srcs/str_utils/ft_split.c @@ -6,12 +6,14 @@ /* By: myeow +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/17 23:18:06 by myeow #+# #+# */ -/* Updated: 2024/04/05 20:08:21 by myeow ### ########.fr */ +/* Updated: 2024/04/05 20:17:02 by myeow ### ########.fr */ /* */ /* ************************************************************************** */ #include +void ft_free_ft_split(char **str_array); + static int ft_countwords(char const *s, char c) { size_t n;