From 9af2885d872de9c60b11159efe0685738031096d Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 14 Feb 2020 03:46:08 +0100 Subject: Added documentation for all functions and refactored ft_strjoin_free -> ft_strjoinf --- src/str/ft_strndup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/str/ft_strndup.c') diff --git a/src/str/ft_strndup.c b/src/str/ft_strndup.c index 0683dae..894ea4e 100644 --- a/src/str/ft_strndup.c +++ b/src/str/ft_strndup.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/25 03:28:52 by cacharle #+# #+# */ -/* Updated: 2019/11/20 04:15:44 by cacharle ### ########.fr */ +/* Updated: 2020/02/14 03:43:55 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,8 @@ char *ft_strndup(const char *s1, size_t n) { char *clone; - if ((clone = ft_strnew(n)) == NULL) + if ((clone = (char*)malloc(sizeof(char) * (n + 1))) == NULL) return (NULL); + clone[n] = '\0'; return (ft_strncpy(clone, s1, n)); } -- cgit