From: Lukas Jiriste Date: Wed, 6 Sep 2023 11:07:57 +0000 (+0200) Subject: Setting errno for inappropriate input has been removed as Moulinette X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=8f9fa2dbd2594152a6aba7f2970438be2d1eaa73;p=Libft.git Setting errno for inappropriate input has been removed as Moulinette deems functions around errno forbidden. --- diff --git a/ft_calloc.c b/ft_calloc.c index a4c55b0..9976848 100644 --- a/ft_calloc.c +++ b/ft_calloc.c @@ -6,11 +6,19 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/08/15 11:34:52 by ljiriste #+# #+# */ -/* Updated: 2023/09/05 18:26:57 by ljiriste ### ########.fr */ +/* Updated: 2023/09/06 13:06:22 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ +/* This should not be commented as to emulate builtin calloc + but errno calls function which is deemed forbidden by Moulinette #include + if (total_bytes / size != nmemb) + { + errno = ENOMEM; + return (NULL); + } +*/ #include // for malloc #include "libft.h" @@ -23,10 +31,7 @@ void *ft_calloc(size_t nmemb, size_t size) return (malloc(0)); total_bytes = nmemb * size; if (total_bytes / size != nmemb) - { - errno = ENOMEM; return (NULL); - } res = malloc(total_bytes); if (res == NULL) return (NULL);