diff --git a/xmalloc.c b/xmalloc.c index ebac8a1d..c90b97dc 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -36,10 +37,8 @@ xmalloc(size_t size) void * xcalloc(size_t nmemb, size_t size) { - if (unlikely(nmemb == 0 || size == 0)) { - size = 1; - } - return check_alloc(calloc(nmemb, size)); + assert(size != 0); + return check_alloc(calloc(likely(nmemb) ? nmemb : 1, size)); } void *