-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_realloc.c
27 lines (24 loc) · 1.09 KB
/
ft_realloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_realloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: edelangh <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/27 11:29:17 by edelangh #+# #+# */
/* Updated: 2014/12/02 20:15:15 by edelangh ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "stdlib.h"
void ft_realloc(void **ptr, size_t slen, size_t nlen)
{
void *new;
if (!ptr)
return ;
new = ft_malloc(nlen);
ft_memcpy(new, *ptr, slen);
if (*ptr)
free(*ptr);
*ptr = new;
}