From 8866ef5699150d0549096efa94fc311ff7a48dc7 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 14:47:33 +0100 Subject: Changing stuff --- src/ft_get_map.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/ft_get_map.c') diff --git a/src/ft_get_map.c b/src/ft_get_map.c index f609c50..6a73e54 100644 --- a/src/ft_get_map.c +++ b/src/ft_get_map.c @@ -50,35 +50,35 @@ static void static int8_t ft_cat_mapl(char *line, size_t i, t_cub *clist) { - if (!(clist->mlist->mapl = (char *)ft_nrealloc(clist->mlist->mapl, - ((clist->mlist->map_w + 1) * i) * sizeof(char), - ((clist->mlist->map_w + 1) * (i + 1)) * sizeof(char)))) + if (!(clist.mlist.mapl = (char *)ft_nrealloc(clist.mlist.mapl, + ((clist.mlist.map_w + 1) * i) * sizeof(char), + ((clist.mlist.map_w + 1) * (i + 1)) * sizeof(char)))) { - ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE); + ft_sprintf(clist.errmsg, "%s", FT_ERR_ALLOCATE); return (-1); } - ft_linecpy(line, clist->mlist->mapl, (clist->mlist->map_w + 1) * i); + ft_linecpy(line, clist.mlist.mapl, (clist.mlist.map_w + 1) * i); return (0); } int ft_get_map_first_line(char *line, t_cub *clist) { - clist->mlist->map_start = clist->mlist->line_chk; + clist.mlist.map_start = clist.mlist.line_chk; if (!line[0]) { ft_memdel((void**)&line); - ft_sprintf(clist->errmsg, "%s", FT_ERR_READ); + ft_sprintf(clist.errmsg, "%s", FT_ERR_READ); return (-1); } - clist->mlist->map_w = ft_get_line_len(line); + clist.mlist.map_w = ft_get_line_len(line); if (ft_check_map_line(line, 1, clist) < 0) { ft_memdel((void**)&line); - ft_sprintf(clist->errmsg, "%s", FT_ERR_READ); + ft_sprintf(clist.errmsg, "%s", FT_ERR_READ); return (-1); } - ft_memdel((void**)&clist->mlist->mapl); + ft_memdel((void**)&clist.mlist.mapl); if (ft_cat_mapl(line, 0, clist) < 0) { ft_memdel((void**)&line); @@ -99,7 +99,7 @@ int ret = 1; while ((ret = get_next_line(fd, &line)) > 0) { - clist->mlist->line_chk += 1; + clist.mlist.line_chk += 1; if (!line[0] || ft_check_map_line(line, 0, clist) < 0 || ft_cat_mapl(line, i, clist) < 0) { @@ -110,10 +110,10 @@ int i++; } ft_memdel((void**)&line); - clist->mlist->mapl[((clist->mlist->map_w + 1) * i) - 1] = '\0'; - ft_free_words(clist->mlist->map); - clist->mlist->map = ft_split(clist->mlist->mapl, '\n'); - clist->mlist->map_h = ft_get_map_h(clist->mlist->map); - ft_memdel((void**)&clist->mlist->mapl); + clist.mlist.mapl[((clist.mlist.map_w + 1) * i) - 1] = '\0'; + ft_free_words(clist.mlist.map); + clist.mlist.map = ft_split(clist.mlist.mapl, '\n'); + clist.mlist.map_h = ft_get_map_h(clist.mlist.map); + ft_memdel((void**)&clist.mlist.mapl); return (0); } -- cgit v1.2.3 From ce43b1cd1caa539af687425f58a6999a20807878 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 3 Mar 2020 16:14:26 +0100 Subject: Going full stack is bav --- src/ft_get_map.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/ft_get_map.c') diff --git a/src/ft_get_map.c b/src/ft_get_map.c index 6a73e54..60bcee0 100644 --- a/src/ft_get_map.c +++ b/src/ft_get_map.c @@ -50,35 +50,35 @@ static void static int8_t ft_cat_mapl(char *line, size_t i, t_cub *clist) { - if (!(clist.mlist.mapl = (char *)ft_nrealloc(clist.mlist.mapl, - ((clist.mlist.map_w + 1) * i) * sizeof(char), - ((clist.mlist.map_w + 1) * (i + 1)) * sizeof(char)))) + if (!(clist->mlist.mapl = (char *)ft_nrealloc(clist->mlist.mapl, + ((clist->mlist.map_w + 1) * i) * sizeof(char), + ((clist->mlist.map_w + 1) * (i + 1)) * sizeof(char)))) { - ft_sprintf(clist.errmsg, "%s", FT_ERR_ALLOCATE); + ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE); return (-1); } - ft_linecpy(line, clist.mlist.mapl, (clist.mlist.map_w + 1) * i); + ft_linecpy(line, clist->mlist.mapl, (clist->mlist.map_w + 1) * i); return (0); } int ft_get_map_first_line(char *line, t_cub *clist) { - clist.mlist.map_start = clist.mlist.line_chk; + clist->mlist.map_start = clist->mlist.line_chk; if (!line[0]) { ft_memdel((void**)&line); - ft_sprintf(clist.errmsg, "%s", FT_ERR_READ); + ft_sprintf(clist->errmsg, "%s", FT_ERR_READ); return (-1); } - clist.mlist.map_w = ft_get_line_len(line); + clist->mlist.map_w = ft_get_line_len(line); if (ft_check_map_line(line, 1, clist) < 0) { ft_memdel((void**)&line); - ft_sprintf(clist.errmsg, "%s", FT_ERR_READ); + ft_sprintf(clist->errmsg, "%s", FT_ERR_READ); return (-1); } - ft_memdel((void**)&clist.mlist.mapl); + ft_memdel((void**)&clist->mlist.mapl); if (ft_cat_mapl(line, 0, clist) < 0) { ft_memdel((void**)&line); @@ -99,7 +99,7 @@ int ret = 1; while ((ret = get_next_line(fd, &line)) > 0) { - clist.mlist.line_chk += 1; + clist->mlist.line_chk += 1; if (!line[0] || ft_check_map_line(line, 0, clist) < 0 || ft_cat_mapl(line, i, clist) < 0) { @@ -110,10 +110,10 @@ int i++; } ft_memdel((void**)&line); - clist.mlist.mapl[((clist.mlist.map_w + 1) * i) - 1] = '\0'; - ft_free_words(clist.mlist.map); - clist.mlist.map = ft_split(clist.mlist.mapl, '\n'); - clist.mlist.map_h = ft_get_map_h(clist.mlist.map); - ft_memdel((void**)&clist.mlist.mapl); + clist->mlist.mapl[((clist->mlist.map_w + 1) * i) - 1] = '\0'; + ft_free_words(clist->mlist.map); + clist->mlist.map = ft_split(clist->mlist.mapl, '\n'); + clist->mlist.map_h = ft_get_map_h(clist->mlist.map); + ft_memdel((void**)&clist->mlist.mapl); return (0); } -- cgit v1.2.3