From 915f1b888cf9c05e4b61321f84ac045eacd8ddd1 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 27 Feb 2020 18:07:57 +0100 Subject: Added ft_lstlfind,ft_lstlsearch and ft_split_destroy --- include/libft_lst.h | 2 +- include/libft_util.h | 20 ++++++++++++++++++++ src/ht/ft_htnew.c | 2 +- src/lst/ft_lstlfind.c | 4 ++-- src/lst/ft_lstlsearch.c | 4 ++-- src/util/ft_split_destroy.c | 24 ++++++++++++++++++++++++ 6 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 include/libft_util.h create mode 100644 src/util/ft_split_destroy.c diff --git a/include/libft_lst.h b/include/libft_lst.h index 2b4321c..5669979 100644 --- a/include/libft_lst.h +++ b/include/libft_lst.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/31 10:36:39 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:09:21 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:23:31 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/include/libft_util.h b/include/libft_util.h new file mode 100644 index 0000000..7a9e056 --- /dev/null +++ b/include/libft_util.h @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_util.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/27 17:51:36 by cacharle #+# #+# */ +/* Updated: 2020/02/27 17:52:16 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_UTIL_H +# define LIBFT_UTIL_H + +# include + +void *ft_split_destroy(char **strs); + +#endif diff --git a/src/ht/ft_htnew.c b/src/ht/ft_htnew.c index f77398f..6827c36 100644 --- a/src/ht/ft_htnew.c +++ b/src/ht/ft_htnew.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/01/30 08:19:16 by cacharle #+# #+# */ -/* Updated: 2020/02/28 12:10:51 by cacharle ### ########.fr */ +/* Updated: 2020/02/28 12:23:43 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/lst/ft_lstlfind.c b/src/lst/ft_lstlfind.c index 92d37d8..c399b6e 100644 --- a/src/lst/ft_lstlfind.c +++ b/src/lst/ft_lstlfind.c @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/17 03:04:52 by cacharle #+# #+# */ -/* Updated: 2020/02/19 02:03:11 by cacharle ### ########.fr */ +/* Created: 2020/02/27 18:00:37 by cacharle #+# #+# */ +/* Updated: 2020/02/28 12:24:05 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/lst/ft_lstlsearch.c b/src/lst/ft_lstlsearch.c index 8d2acc8..f59b5de 100644 --- a/src/lst/ft_lstlsearch.c +++ b/src/lst/ft_lstlsearch.c @@ -5,8 +5,8 @@ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2020/02/17 02:57:12 by cacharle #+# #+# */ -/* Updated: 2020/02/17 03:35:45 by cacharle ### ########.fr */ +/* Created: 2020/02/27 16:18:33 by cacharle #+# #+# */ +/* Updated: 2020/02/28 12:24:31 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/src/util/ft_split_destroy.c b/src/util/ft_split_destroy.c new file mode 100644 index 0000000..bc3f4e6 --- /dev/null +++ b/src/util/ft_split_destroy.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_split_destroy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/27 16:30:55 by cacharle #+# #+# */ +/* Updated: 2020/02/27 17:52:31 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_util.h" + +void *ft_split_destroy(char **strs) +{ + int i; + + i = -1; + while (strs[++i] != NULL) + free(strs[i]); + free(strs); + return (NULL); +} -- cgit