60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_freer.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/01/08 15:01:40 by cchauvet #+# #+# */
|
|
/* Updated: 2023/01/08 15:39:31 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "solong.h"
|
|
|
|
void ft_freer_ultimate(size_t len, ...)
|
|
{
|
|
|
|
va_list va;
|
|
size_t i;
|
|
|
|
i = 0;
|
|
va_start(va, len);
|
|
while (i < len)
|
|
{
|
|
free(va_arg(va, char *));
|
|
i++;
|
|
}
|
|
va_end(va);
|
|
}
|
|
|
|
void ft_freer_tab(char **tab)
|
|
{
|
|
size_t i;
|
|
|
|
i = 0;
|
|
if (tab == NULL)
|
|
return ;
|
|
while (tab[i] != NULL)
|
|
{
|
|
free(tab[i]);
|
|
i++;
|
|
}
|
|
free(tab);
|
|
}
|
|
|
|
void ft_freer_tab_ultimate(size_t len, ...)
|
|
{
|
|
va_list va;
|
|
size_t i;
|
|
|
|
i = 0;
|
|
va_start(va, len);
|
|
while (i < len)
|
|
{
|
|
ft_freer_tab(va_arg(va, char **));
|
|
i++;
|
|
}
|
|
va_end(va);
|
|
}
|