32 lines
1.2 KiB
C
32 lines
1.2 KiB
C
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* ft_tabrealloc.c :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2023/01/05 18:58:48 by cchauvet #+# #+# */
|
||
|
/* Updated: 2023/01/10 18:30:21 by cchauvet ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "extra.h"
|
||
|
|
||
|
char **ft_tabrealloc(char **tab, size_t current_size, size_t new_size)
|
||
|
{
|
||
|
char **new;
|
||
|
size_t i;
|
||
|
|
||
|
new = ft_calloc(new_size, sizeof(char *));
|
||
|
if (new == NULL)
|
||
|
return (NULL);
|
||
|
i = 0;
|
||
|
while (i < current_size)
|
||
|
{
|
||
|
new[i] = tab[i];
|
||
|
i++;
|
||
|
}
|
||
|
free(tab);
|
||
|
return (new);
|
||
|
}
|