correction memcpy pour le cas ou dst et src sont nuls

This commit is contained in:
Hugo LAMY
2019-11-28 13:51:50 +01:00
parent feede2804f
commit b542d8adc0
152 changed files with 3206 additions and 5 deletions

27
srcs/ft_memalloc.c Normal file
View File

@@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memalloc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/19 15:21:44 by hulamy #+# #+# */
/* Updated: 2019/11/19 15:23:17 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
/*
** allocate size byte of memory and return a pointer to the allocated memory
*/
#include "libft.h"
void *ft_memalloc(size_t size)
{
void *tmp;
if (!size || !(tmp = malloc(size)))
return (NULL);
ft_bzero(tmp, size);
return (tmp);
}