2023-01-05 13:04:29 -05:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* ft_tabrealloc.c :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2023/01/05 18:58:48 by cchauvet #+# #+# */
|
2023-01-10 13:04:46 -05:00
|
|
|
/* Updated: 2023/01/10 18:30:21 by cchauvet ### ########.fr */
|
2023-01-05 13:04:29 -05:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "extra.h"
|
|
|
|
|
|
|
|
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size)
|
|
|
|
{
|
|
|
|
char **new;
|
|
|
|
size_t i;
|
|
|
|
|
2023-01-09 14:41:06 -05:00
|
|
|
new = ft_calloc(new_size, sizeof(char *));
|
2023-01-05 13:04:29 -05:00
|
|
|
if (new == NULL)
|
|
|
|
return (NULL);
|
|
|
|
i = 0;
|
|
|
|
while (i < current_size)
|
|
|
|
{
|
|
|
|
new[i] = tab[i];
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
free(tab);
|
|
|
|
return (new);
|
|
|
|
}
|