Free file
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
|
/* Created: 2025/11/25 19:47:02 by aortigos #+# #+# */
|
||||||
/* Updated: 2025/11/28 20:00:36 by aortigos ### ########.fr */
|
/* Updated: 2025/11/28 20:13:53 by aortigos ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -30,9 +30,18 @@
|
|||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
|
|
||||||
|
// parsing.c
|
||||||
int read_map(char *av, t_data *map, int *count);
|
int read_map(char *av, t_data *map, int *count);
|
||||||
void get_x_y_player(t_data *data);
|
void get_x_y_player(t_data *data);
|
||||||
int check_extension_map(char *file);
|
int check_extension_map(char *file);
|
||||||
int parsing(int ac, char **av, t_data *data);
|
int parsing(int ac, char **av, t_data *data);
|
||||||
|
|
||||||
|
//frees.c
|
||||||
|
void freetl(char *ture, char *line, int fd);
|
||||||
|
void free_map(t_data *data);
|
||||||
|
void free_m(t_mlx *mlx);
|
||||||
|
void freelist(t_turelist **txture);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* frees.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/11/28 20:03:22 by aortigos #+# #+# */
|
||||||
|
/* Updated: 2025/11/28 20:09:04 by aortigos ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "../../includes/cub3d.h"
|
||||||
|
|
||||||
|
void freetl(char *ture, char *line, int fd)
|
||||||
|
{
|
||||||
|
if (ture)
|
||||||
|
ft_memfree(ture);
|
||||||
|
if (line)
|
||||||
|
ft_memfree(line);
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_map(t_data *data)
|
||||||
|
{
|
||||||
|
free2d(data->sq_map);
|
||||||
|
free2d(data->map2d);
|
||||||
|
free2d(data->ture2d);
|
||||||
|
if (data->ff)
|
||||||
|
free2d(data->ff);
|
||||||
|
if (data->cc)
|
||||||
|
free2d(data->cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_m(t_mlx *mlx)
|
||||||
|
{
|
||||||
|
if (mlx->dt->sq_map)
|
||||||
|
free2d(mlx->dt->sq_map);
|
||||||
|
if(mlx->dt->map2d)
|
||||||
|
free2d(mlx->dt->map2d);
|
||||||
|
if (mlx->dt->ture2d)
|
||||||
|
free2d(mlx->dt->ture2d);
|
||||||
|
if (mlx->dt->ff)
|
||||||
|
free2d(mlx->dt->ff);
|
||||||
|
if (mlx->dt->cc)
|
||||||
|
free2d(mlx->dt->cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void freelist(t_turelist **txture)
|
||||||
|
{
|
||||||
|
t_turelist *tmp;
|
||||||
|
|
||||||
|
tmp = *txture;
|
||||||
|
while (tmp)
|
||||||
|
{
|
||||||
|
*txture = tmp->next;
|
||||||
|
ft_memfree(tmp->name);
|
||||||
|
ft_memfree(tmp->value);
|
||||||
|
ft_memfree(tmp);
|
||||||
|
tmp = *txture;
|
||||||
|
}
|
||||||
|
ft_memfree(*txture);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user