From cc6e7378d3f5473137e0c46d39173e6f60dcefda Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Tue, 30 Jan 2024 14:57:46 -0500 Subject: update standards and safety checks --- src/stdlib/calloc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/stdlib/calloc.c') diff --git a/src/stdlib/calloc.c b/src/stdlib/calloc.c index 609cd0d4..e5b5f38b 100644 --- a/src/stdlib/calloc.c +++ b/src/stdlib/calloc.c @@ -1,7 +1,6 @@ -#if 0 - #include #include +#include "_stdlib.h" /** allocate and initialize memory **/ @@ -10,6 +9,8 @@ void * calloc(size_t nmemb, size_t size) void *p = NULL; size_t total = nmemb * size; + SIGNAL_SAFE(0); + if (total < nmemb || total < size) { return NULL; } @@ -38,6 +39,3 @@ RETURN_FAILURE(CONSTANT(NULL)) RETURN_SUCCESS(a pointer to the newly allocated memory) STDC(1) */ - - -#endif -- cgit v1.2.1