Created
November 28, 2013 02:40
-
-
Save lambda2/7686494 to your computer and use it in GitHub Desktop.
ft_memrealloc.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ************************************************************************** */ | |
| /* */ | |
| /* ::: :::::::: */ | |
| /* ft_memrealloc.c :+: :+: :+: */ | |
| /* +:+ +:+ +:+ */ | |
| /* By: aaubin <[email protected]> +#+ +:+ +#+ */ | |
| /* +#+#+#+#+#+ +#+ */ | |
| /* Created: 2013/11/28 02:36:34 by aaubin #+# #+# */ | |
| /* Updated: 2013/11/28 03:35:07 by aaubin ### ########.fr */ | |
| /* */ | |
| /* ************************************************************************** */ | |
| #include "libft.h" | |
| void * ft_memrealloc(void *buf, size_t old_size, size_t new_size) | |
| { | |
| char *new_buf; | |
| char *_buf; | |
| _buf = (char *) buf; | |
| new_buf = ft_memalloc(new_size); | |
| if ( new_buf ) | |
| { | |
| new_buf = ft_memcpy((void *) new_buf, (void *) buf, old_size); | |
| free(buf); | |
| } | |
| return ( (void *) new_buf ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment