From: Joel Rosdahl Date: Sat, 19 Oct 2019 10:39:35 +0000 (+0200) Subject: Remove obsolete x_calloc function X-Git-Tag: v4.0~730 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=804dd3ecea1344f11d79c1618d6d115f0f6e94e1;p=thirdparty%2Fccache.git Remove obsolete x_calloc function --- diff --git a/src/ccache.hpp b/src/ccache.hpp index e7cfd7244..62f7cc484 100644 --- a/src/ccache.hpp +++ b/src/ccache.hpp @@ -171,7 +171,6 @@ void reformat(char** ptr, const char* format, ...) ATTR_FORMAT(printf, 2, 3); char* x_strdup(const char* s); char* x_strndup(const char* s, size_t n); void* x_malloc(size_t size); -void* x_calloc(size_t nmemb, size_t size); void* x_realloc(void* ptr, size_t size); void x_setenv(const char* name, const char* value); void x_unsetenv(const char* name); diff --git a/src/legacy_util.cpp b/src/legacy_util.cpp index 37874cde8..82df17e35 100644 --- a/src/legacy_util.cpp +++ b/src/legacy_util.cpp @@ -674,22 +674,6 @@ x_malloc(size_t size) return ret; } -// This is like calloc() but dies if the allocation fails. -void* -x_calloc(size_t nmemb, size_t size) -{ - if (nmemb * size == 0) { - // calloc() may return NULL if nmemb or size is 0, so always do this to - // make sure that the code handles it regardless of platform. - return NULL; - } - void* ret = calloc(nmemb, size); - if (!ret) { - fatal("x_calloc: Could not allocate %lu bytes", (unsigned long)size); - } - return ret; -} - // This is like realloc() but dies if the malloc fails. void* x_realloc(void* ptr, size_t size)