-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror_messages_a.c
108 lines (97 loc) · 2.12 KB
/
error_messages_a.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error_messages_a.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmeier <mmeier@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/13 15:53:19 by mmeier #+# #+# */
/* Updated: 2024/04/18 10:59:35 by mmeier ### ########.fr */
/* */
/* ************************************************************************** */
#include "so_long.h"
int free_arr_rectangle(char **av)
{
int j;
j = 0;
if (av[j] == NULL || av == NULL)
return (-1);
while (av[j])
{
free(av[j]);
av[j] = NULL;
j++;
}
free(av);
av = NULL;
ft_printf("Error\nMap is not a rectangle :(\n");
return (0);
}
int free_arr_border(char **av)
{
int j;
j = 0;
if (av[j] == NULL || av == NULL)
return (-1);
while (av[j])
{
free(av[j]);
av[j] = NULL;
j++;
}
free(av);
av = NULL;
ft_printf("Error\nNo valid borders :(\n");
return (0);
}
int free_arr_char(char **av)
{
int j;
j = 0;
if (av[j] == NULL || av == NULL)
return (-1);
while (av[j])
{
free(av[j]);
av[j] = NULL;
j++;
}
free(av);
av = NULL;
ft_printf("Error\nMap contains invalid characters :(\n");
return (0);
}
int free_arr_c_count(char **av)
{
int j;
j = 0;
if (av[j] == NULL || av == NULL)
return (-1);
while (av[j])
{
free(av[j]);
av[j] = NULL;
j++;
}
free(av);
av = NULL;
ft_printf("Error\nMap does not contain correct amount of characters :(\n");
return (0);
}
int free_arr_valid_path(char **av)
{
int j;
j = 0;
if (av[j] == NULL || av == NULL)
return (-1);
while (av[j])
{
free(av[j]);
av[j] = NULL;
j++;
}
free(av);
av = NULL;
ft_printf("Error\nNo valid path :(\n");
return (0);
}