aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_sort_s_t.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-03-26 14:15:26 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-03-26 14:15:26 +0100
commitd29165bbb95aef86aeb9d9d9668d035b4430769f (patch)
tree031f29761205f26b540782d42b692165d0ad3f2c /src/ft_sort_s_t.c
parenttab (diff)
download42-cub3d-d29165bbb95aef86aeb9d9d9668d035b4430769f.tar.gz
42-cub3d-d29165bbb95aef86aeb9d9d9668d035b4430769f.tar.bz2
42-cub3d-d29165bbb95aef86aeb9d9d9668d035b4430769f.tar.xz
42-cub3d-d29165bbb95aef86aeb9d9d9668d035b4430769f.tar.zst
42-cub3d-d29165bbb95aef86aeb9d9d9668d035b4430769f.zip
Cool malloc
Diffstat (limited to 'src/ft_sort_s_t.c')
-rw-r--r--src/ft_sort_s_t.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/ft_sort_s_t.c b/src/ft_sort_s_t.c
index 6a74c61..6c08882 100644
--- a/src/ft_sort_s_t.c
+++ b/src/ft_sort_s_t.c
@@ -15,20 +15,22 @@
#include <stdlib.h>
#include <stdint.h>
-void
- ft_alloc_dist_tab(float ***dist_tab, t_cub *cl)
+float
+ **ft_alloc_dist_tab(void)
{
uint16_t i;
+ float **dist_tab;
- if (!(*dist_tab = (float **)malloc(8 * sizeof(float*))))
- ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, cl);
+ if (!(dist_tab = (float **)malloc(8 * sizeof(float*))))
+ return (NULL);
i = 0;
while (i < 8)
{
- if (!((*dist_tab)[i] = (float *)malloc(4096 * sizeof(float))))
- ft_error(FT_RET_ALLOC_ERR, FT_ERR_ALLOCATE, cl);
+ if (!(dist_tab[i] = (float *)malloc(4096 * sizeof(float))))
+ return (NULL);
i++;
}
+ return (dist_tab);
}
static void