-
Notifications
You must be signed in to change notification settings - Fork 0
/
error_handling.c
40 lines (35 loc) · 1.24 KB
/
error_handling.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_handling.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zhlim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/11 16:44:26 by zhlim #+# #+# */
/* Updated: 2023/07/21 21:05:37 by zhlim ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void print_error_exit(char *msg)
{
ft_printf("%sError\n%s\n%s", RED, msg, NONE);
exit(1);
}
void free_map(t_map *map)
{
int i;
i = 0;
while (i < map->rows)
{
free(map->grid[i]);
i++;
}
free(map->grid);
}
void free_error_exit(t_map *map, char *msg)
{
if (msg)
ft_printf("%sError\n%s\n%s", RED, msg, NONE);
free_map(map);
exit(0);
}