MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / rpcalloc

Function rpcalloc

vm/ByteCodeTranslator/src/rpmalloc.c:1625–1648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1623}
1624
1625void*
1626rpcalloc(size_t num, size_t size) {
1627 size_t total;
1628#if ENABLE_VALIDATE_ARGS
1629#ifdef PLATFORM_WINDOWS
1630 int err = SizeTMult(num, size, &total);
1631 if ((err != S_OK) || (total >= MAX_ALLOC_SIZE)) {
1632 errno = EINVAL;
1633 return 0;
1634 }
1635#else
1636 int err = __builtin_umull_overflow(num, size, &total);
1637 if (err || (total >= MAX_ALLOC_SIZE)) {
1638 errno = EINVAL;
1639 return 0;
1640 }
1641#endif
1642#else
1643 total = num * size;
1644#endif
1645 void* ptr = _memory_allocate(total);
1646 memset(ptr, 0, total);
1647 return ptr;
1648}
1649
1650void*
1651rprealloc(void* ptr, size_t size) {

Callers 1

callocFunction · 0.85

Calls 1

_memory_allocateFunction · 0.85

Tested by

no test coverage detected