diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 22:10:16 +0100 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-03-06 22:10:16 +0100 |
commit | 079a4b6e9389b05db2c672594cfb2f2b197e35dd (patch) | |
tree | f4a2bc882dd7667e2c9758e2be38e3484879e225 /src/ft_get_music.c | |
parent | qwe (diff) | |
parent | okok (diff) | |
download | 42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.gz 42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.bz2 42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.xz 42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.tar.zst 42-cub3d-079a4b6e9389b05db2c672594cfb2f2b197e35dd.zip |
Merge branch 'fork-music'
Diffstat (limited to '')
-rw-r--r-- | src/ft_get_music.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ft_get_music.c b/src/ft_get_music.c index cdd7039..2383e0a 100644 --- a/src/ft_get_music.c +++ b/src/ft_get_music.c @@ -15,7 +15,7 @@ #include <stdlib.h> #include <stdint.h> -static void +static int8_t ft_set_music_cmd(t_map *mlist) { uint8_t len; @@ -24,9 +24,13 @@ static void len += ft_strlen(FT_MUS_CMD) - 2; ft_memdel((void**)&mlist->music_cmd); if (!(mlist->music_cmd = (char *)malloc((len + 1) * sizeof(char)))) - return ; + return (-1); ft_sprintf(mlist->music_cmd, FT_MUS_CMD, mlist->music_path); + ft_free_words(mlist->mcmd_words); + if (!(mlist->mcmd_words = ft_split(mlist->music_cmd, ' '))) + return (-1); + return (0); } int8_t @@ -54,6 +58,5 @@ int8_t return (-1); } clist->mlist.ismusic = 1; - ft_set_music_cmd(&clist->mlist); - return (0); + return ((ft_set_music_cmd(&clist->mlist) == 0) ? (0) : (-1)); } |