-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfree_parser.c
More file actions
52 lines (47 loc) · 1.46 KB
/
free_parser.c
File metadata and controls
52 lines (47 loc) · 1.46 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* free_parser.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: walnaimi <walnaimi@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/21 14:53:55 by sataskin #+# #+# */
/* Updated: 2025/01/09 14:08:24 by walnaimi ### ########.fr */
/* */
/* ************************************************************************** */
#include "minirt.h"
void free_minirt(t_minirt *freeable, char *error)
{
t_arg *temp;
temp = NULL;
if (freeable->line != NULL)
free(freeable->line);
if (error != NULL)
write(2, error, ft_strlen(error));
if (freeable->l_list == NULL)
exit (1);
if (freeable->l_list != NULL)
{
temp = freeable->l_list->next;
while (freeable->l_list != NULL)
{
free(freeable->l_list);
if (temp == NULL)
exit(1);
freeable->l_list = temp;
temp = temp->next;
}
}
exit(1);
}
void free_split(char **str)
{
int i;
i = 0;
while (str[i] != NULL)
{
free(str[i]);
i++;
}
free(str);
}