From 7514811995c3573716008af1c6c409911ac1ea4a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 24 Jan 2020 18:56:40 +0100 Subject: strdups --- src/ft_get_sprite_tex.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/ft_get_sprite_tex.c') diff --git a/src/ft_get_sprite_tex.c b/src/ft_get_sprite_tex.c index 4cec41a..b246b5e 100644 --- a/src/ft_get_sprite_tex.c +++ b/src/ft_get_sprite_tex.c @@ -7,7 +7,6 @@ ft_get_sprite_tex(int fd, t_win *wlist) { char *line; char **words; - size_t len; get_next_line(fd, &line); if (!(words = ft_split(line, ' '))) @@ -21,13 +20,11 @@ ft_get_sprite_tex(int fd, t_win *wlist) return (ft_map_error(7, wlist)); } ft_memdel(wlist->clist->sprite_path); - len = ft_strlen(*(words + 1)); - if (!(wlist->clist->sprite_path = (char*)malloc((len + 1) * sizeof(char)))) + if (!(wlist->clist->sprite_path = ft_strdup(*(words + 1)))) { ft_free_words(words, line); return (-1); } - ft_strlcpy(wlist->clist->sprite_path, *(words + 1), len + 1); ft_free_words(words, line); return (0); } -- cgit v1.2.3