From 9901cd05849fa0ef396f09f57b07807ebd96ca32 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 20 Nov 2019 04:04:55 +0100 Subject: refactored everything --- ft_split.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ft_split.c') diff --git a/ft_split.c b/ft_split.c index d4ceabf..999c664 100644 --- a/ft_split.c +++ b/ft_split.c @@ -6,11 +6,11 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/17 08:29:02 by cacharle #+# #+# */ -/* Updated: 2019/10/17 08:39:40 by cacharle ### ########.fr */ +/* Updated: 2019/11/20 03:54:26 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ -#include +#include "libft.h" static size_t count_segment(char const *s, char c) { @@ -52,11 +52,10 @@ static char *ft_strndup(const char *s1, size_t n) static void *destroy_strs(char **strs) { - int i; - - i = 0; - while (strs[i] != NULL) - free(strs[i++]); + if (strs == NULL) + return (NULL); + while (*strs != NULL) + free(*strs++); free(strs); return (NULL); } -- cgit