From 9a915b797a80c2a776027b1fcc37f1e7b8ab1b24 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 29 Sep 2020 19:50:20 +0200 Subject: Update --- libft/src/ft_strmapi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libft/src/ft_strmapi.c') diff --git a/libft/src/ft_strmapi.c b/libft/src/ft_strmapi.c index fe455c1..6821802 100644 --- a/libft/src/ft_strmapi.c +++ b/libft/src/ft_strmapi.c @@ -12,8 +12,7 @@ #include -char - *ft_strmapi(const char *s, char (*f)(unsigned int, char)) +char *ft_strmapi(const char *s, char (*f)(unsigned int, char)) { unsigned int i; char *nstr; @@ -22,9 +21,9 @@ char return (NULL); i = 0; nstr = (char *)ft_calloc(ft_strlen(s) + 1, sizeof(char)); - if (!nstr) + if (nstr == NULL) return (NULL); - while (s[i]) + while (s[i] != '\0') { nstr[i] = (*f)(i, s[i]); i++; -- cgit v1.2.3