realloc, havent tested it yet :OOOO
This commit is contained in:
parent
138ffb7a54
commit
42b64ac99b
6 changed files with 30 additions and 5 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
23
libft/src/mem/ft_realloc.c
Normal file
23
libft/src/mem/ft_realloc.c
Normal 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);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue