diff options
Diffstat (limited to 'src/ft_init_lists.c')
-rw-r--r-- | src/ft_init_lists.c | 13 |
1 files changed, 5 insertions, 8 deletions
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 <libft.h> #include <mlx.h> #include <cub3d.h> +#include <stddef.h> #include <stdlib.h> 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); } |