-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_memrealloc.c
More file actions
29 lines (26 loc) · 1.18 KB
/
ft_memrealloc.c
File metadata and controls
29 lines (26 loc) · 1.18 KB
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
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memrealloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: loram <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/09/21 17:27:51 by loram #+# #+# */
/* Updated: 2019/09/21 18:16:19 by loram ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
void *ft_memrealloc(void *src, size_t new_size, size_t old_size)
{
void *new;
if (!new_size)
return (NULL);
if (!src)
return (ft_memalloc(new_size));
if (!(new = ft_memalloc(new_size)))
return (NULL);
ft_memmove(new, src, old_size);
free(src);
return (new);
}