From d3fb362c2e0b83cc9754a05ae5bc4a68a5f9269d Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 10 May 2020 22:01:15 +0200 Subject: Added ft_strtof, ft_atof, ft_vectobuf32, ft_split_len (not tested) --- src/dstr/ft_dstrnew.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/dstr') diff --git a/src/dstr/ft_dstrnew.c b/src/dstr/ft_dstrnew.c index 8ae4a64..c280dd1 100644 --- a/src/dstr/ft_dstrnew.c +++ b/src/dstr/ft_dstrnew.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/03 13:54:52 by charles #+# #+# */ -/* Updated: 2020/04/04 19:50:38 by charles ### ########.fr */ +/* Updated: 2020/05/09 12:57:17 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,9 +23,13 @@ t_ftdstr *ft_dstrnew(char *from) { t_ftdstr *dstr; + dstr = NULL; if ((dstr = (t_ftdstr*)malloc(sizeof(t_ftdstr))) == NULL || (dstr->str = ft_strdup(from)) == NULL) + { + free(dstr); return (NULL); + } dstr->length = ft_strlen(from); dstr->capacity = dstr->length + 1; return (dstr); -- cgit