-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.c
More file actions
44 lines (40 loc) · 1.42 KB
/
error.c
File metadata and controls
44 lines (40 loc) · 1.42 KB
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
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tborges- <tborges-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/18 17:31:57 by tborges- #+# #+# */
/* Updated: 2024/12/02 19:42:58 by tborges- ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
/**
* Exits the program with an error message.
*/
void error_exit(const char *message)
{
ft_printf("Error\n%s\n", message);
exit(1);
}
/**
* Exits the program with an error message.
* Frees the map memory if it exists.
*/
void error_exit_map(const char *message, t_map *map)
{
if (map)
free_map(map);
error_exit(message);
}
/**
* Exits the program with an error message.
* Frees the game memory if it exists.
*/
void error_exit_game(const char *message, t_game *game)
{
if (game)
free_game(game);
error_exit(message);
}