-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_realloc.c
executable file
·25 lines (22 loc) · 1.16 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
/* ************************************************************************** */
/* LE - / */
/* / */
/* ft_realloc.c .:: .:/ . .:: */
/* +:+:+ +: +: +:+:+ */
/* By: brobicho <[email protected]> +:+ +: +: +:+ */
/* #+# #+ #+ #+# */
/* Created: 2017/12/04 03:02:36 by brobicho #+# ## ## #+# */
/* Updated: 2017/12/10 13:34:54 by brobicho ### #+. /#+ ###.fr */
/* / */
/* / */
/* ************************************************************************** */
#include "libft.h"
void *ft_realloc(void *mem, size_t size)
{
void *mem_cpy;
if (!mem || !size || !(mem_cpy = ft_strnew(size)))
return (NULL);
ft_strcpy(mem_cpy, mem);
free(mem);
return (mem_cpy);
}