realloc, havent tested it yet :OOOO

This commit is contained in:
Jack Halford 2016-11-11 20:57:21 +01:00
parent b3e78bb758
commit 3eef8e3f7b
6 changed files with 30 additions and 5 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */ /* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
/* Updated: 2016/11/10 14:40:54 by jhalford ### ########.fr */ /* Updated: 2016/11/11 17:47:12 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -128,4 +128,6 @@ char *ft_path_notdir(char *path);
int ft_printf(const char *format, ...); int ft_printf(const char *format, ...);
char *ft_getenv(char **env, char *key); char *ft_getenv(char **env, char *key);
void *ft_realloc(void *data, int size)
#endif #endif

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:25 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:25 by jhalford #+# #+# */
/* Updated: 2016/11/08 13:15:50 by jhalford ### ########.fr */ /* Updated: 2016/11/11 17:40:57 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:28 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:28 by jhalford #+# #+# */
/* Updated: 2016/11/03 14:57:29 by jhalford ### ########.fr */ /* Updated: 2016/11/11 17:41:21 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:31 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:31 by jhalford #+# #+# */
/* Updated: 2016/11/08 13:17:29 by jhalford ### ########.fr */ /* Updated: 2016/11/11 17:39:00 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/03 14:57:34 by jhalford #+# #+# */ /* Created: 2016/11/03 14:57:34 by jhalford #+# #+# */
/* Updated: 2016/11/07 13:46:42 by jhalford ### ########.fr */ /* Updated: 2016/11/11 17:41:14 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -0,0 +1,23 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_realloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/11 17:37:53 by jhalford #+# #+# */
/* Updated: 2016/11/11 17:41:30 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_realloc(void *data, int size)
{
void *new;
new = ft_memalloc(size);
ft_memcpy(new, data, size);
ft_memdel(&data);
return (new);
}