MCPcopy Create free account
hub / github.com/catboost/catboost / calloc

Function calloc

library/cpp/lfalloc/lf_allocX64.cpp:86–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86extern "C" void* calloc(size_t n, size_t elem_size) {
87 // Overflow check
88 const size_t size = n * elem_size;
89 if (elem_size != 0 && size / elem_size != n)
90 return nullptr;
91
92 void* result = LFAlloc(size);
93 if (result != nullptr) {
94 memset(result, 0, size);
95 }
96 return result;
97}
98
99extern "C" void cfree(void* ptr) {
100 LFFree(ptr);

Callers

nothing calls this directly

Calls 1

LFAllocFunction · 0.85

Tested by

no test coverage detected