aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_sprite_tex.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 18:56:40 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-01-24 18:56:40 +0100
commit7514811995c3573716008af1c6c409911ac1ea4a (patch)
tree08e7af8ed7df36971cb06b63e81a49695963eb3d /src/ft_get_sprite_tex.c
parentcleaner frees (diff)
download42-cub3d-7514811995c3573716008af1c6c409911ac1ea4a.tar.gz
42-cub3d-7514811995c3573716008af1c6c409911ac1ea4a.tar.bz2
42-cub3d-7514811995c3573716008af1c6c409911ac1ea4a.tar.xz
42-cub3d-7514811995c3573716008af1c6c409911ac1ea4a.tar.zst
42-cub3d-7514811995c3573716008af1c6c409911ac1ea4a.zip
strdups
Diffstat (limited to 'src/ft_get_sprite_tex.c')
-rw-r--r--src/ft_get_sprite_tex.c5
1 files changed, 1 insertions, 4 deletions
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);
}