aboutsummaryrefslogtreecommitdiff
path: root/ft_calloc.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-08 18:33:20 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-08 18:33:20 +0200
commitf723389e5143c9ee0bc3d9774bb523b1c752b74c (patch)
tree3ef33b7024c9e6c0680ddce684dcc5a5b13bbca1 /ft_calloc.c
parent4e2e8aac225f2a226573ae36e5327a8c4073bbbc (diff)
downloadlibft-f723389e5143c9ee0bc3d9774bb523b1c752b74c.tar.gz
libft-f723389e5143c9ee0bc3d9774bb523b1c752b74c.tar.bz2
libft-f723389e5143c9ee0bc3d9774bb523b1c752b74c.zip
Fix ft_memmove and calloc
- memmove doesnt depend on a buffer size - calloc return NULL if count or size == 0 - added byte type
Diffstat (limited to 'ft_calloc.c')
-rw-r--r--ft_calloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ft_calloc.c b/ft_calloc.c
index a6d88a0..0cdce92 100644
--- a/ft_calloc.c
+++ b/ft_calloc.c
@@ -17,6 +17,10 @@ void *ft_calloc(size_t count, size_t size)
{
void *mem;
+ if (count == 0 || size == 0)
+ {
+ return (NULL);
+ }
if ((mem = malloc(count * size)) == NULL)
return (NULL);
ft_bzero(mem, count * size);