]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove obsolete x_calloc function
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 19 Oct 2019 10:39:35 +0000 (12:39 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 19 Oct 2019 10:45:09 +0000 (12:45 +0200)
src/ccache.hpp
src/legacy_util.cpp

index e7cfd7244e38913c2a8dcdc1bae9bfe7be89b7dd..62f7cc484e765ec7e0019cd7efb0d28c3230111e 100644 (file)
@@ -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);
index 37874cde8d3cc10fa8e59bd4088fc50ef23d7df6..82df17e35b01e06ee21d49e57491a73b609c60d3 100644 (file)
@@ -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)