MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / reallocarray

Function reallocarray

source/extern/malloc.c:277–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275reallocarray(void* ptr, size_t count, size_t size);
276
277extern void* RPMALLOC_CDECL
278reallocarray(void* ptr, size_t count, size_t size) {
279 size_t total;
280#if ENABLE_VALIDATE_ARGS
281#ifdef _MSC_VER
282 int err = SizeTMult(count, size, &total);
283 if ((err != S_OK) || (total >= MAX_ALLOC_SIZE)) {
284 errno = EINVAL;
285 return 0;
286 }
287#else
288 int err = __builtin_umull_overflow(count, size, &total);
289 if (err || (total >= MAX_ALLOC_SIZE)) {
290 errno = EINVAL;
291 return 0;
292 }
293#endif
294#else
295 total = count * size;
296#endif
297 return realloc(ptr, total);
298}
299
300extern inline void* RPMALLOC_CDECL
301valloc(size_t size) {

Callers

nothing calls this directly

Calls 1

reallocFunction · 0.70

Tested by

no test coverage detected