/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strdup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 14:25:41 by jhalford #+# #+# */ /* Updated: 2017/03/07 14:27:58 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strdup(const char *s1) { char *dup; if (!s1 || !(dup = (char*)malloc(sizeof(*dup) * (ft_strlen(s1) + 1)))) return (NULL); ft_strcpy(dup, s1); return (dup); }