34 lines
1.2 KiB
C
34 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/05 18:58:59 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 = malloc(new_size * sizeof(char *));
|
||
|
if (new == NULL)
|
||
|
return (NULL);
|
||
|
i = 0;
|
||
|
while (i < current_size)
|
||
|
{
|
||
|
new[i] = tab[i];
|
||
|
i++;
|
||
|
}
|
||
|
free(tab);
|
||
|
return (new);
|
||
|
}
|
||
|
|
||
|
|