From fbd69257b509d3374573282ee08f5d9fc9ed4095 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Fri, 24 Jan 2020 00:09:11 +0100 Subject: It ain't much but it's honest work --- src/ft_init_lists.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/ft_init_lists.c') diff --git a/src/ft_init_lists.c b/src/ft_init_lists.c index 7a6eb79..126843c 100644 --- a/src/ft_init_lists.c +++ b/src/ft_init_lists.c @@ -1,6 +1,7 @@ #include #include #include +#include #include t_win @@ -8,13 +9,8 @@ t_win { t_win *wlist; - wlist = (t_win*)malloc(sizeof(t_win)); - wlist->x_size = 800; - wlist->y_size = 600; - wlist->wlx = mlx_init(); - wlist->winptr = (void*)malloc(wlist->x_size * wlist->y_size); - wlist->winptr = mlx_new_window(wlist->wlx, wlist->x_size, wlist->y_size, "Cub3D"); - ft_printf("Created window of size %dx%d\n", wlist->x_size, wlist->y_size); + if (!(wlist = (t_win*)malloc(sizeof(t_win)))) + return (NULL); return (wlist); } @@ -23,6 +19,7 @@ t_cub { t_cub *clist; - clist = (t_cub*)malloc(sizeof(t_cub)); + if (!(clist = (t_cub*)malloc(sizeof(t_cub)))) + return (NULL); return (clist); } -- cgit v1.2.3