-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_error.c
More file actions
52 lines (46 loc) · 1.36 KB
/
ft_error.c
File metadata and controls
52 lines (46 loc) · 1.36 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
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_error.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yel-mota <yel-mota@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/08 16:22:11 by yel-mota #+# #+# */
/* Updated: 2025/04/09 17:15:06 by yel-mota ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
void ft_error_close(char *str, char *mess, int fd)
{
free(str);
ft_putstr_fd(mess, 2);
if (fd > 0)
close(fd);
exit(1);
}
void ft_error_0(char *mess)
{
ft_putstr_fd(mess, 2);
exit(1);
}
void ft_free_all(char *str, char *str2, char *mess, int fd)
{
free(str);
free(str2);
ft_putstr_fd(mess, 2);
if (fd > 0)
close(fd);
exit(1);
}
char *ft_free_map(char **map)
{
int i;
i = 0;
while (map[i] != NULL)
{
free(map[i]);
i++;
}
free(map);
return (NULL);
}