MCPcopy Create free account
hub / github.com/ZeroIntensity/pointers.py / calloc

Function calloc

src/pointers/calloc.py:125–132  ·  view source on GitHub ↗

Allocate a number of blocks with a given size.

(num: int, size: int)

Source from the content-addressed store, hash-verified

123
124
125def calloc(num: int, size: int) -> AllocatedArrayPointer:
126 """Allocate a number of blocks with a given size."""
127 address: int = c_calloc(num, size)
128
129 if not address:
130 raise AllocationError("failed to allocate memory")
131
132 return AllocatedArrayPointer(address, num, size, 0)

Callers 2

_Function · 0.90
calloc_example.pyFile · 0.90

Calls 3

c_callocFunction · 0.85
AllocationErrorClass · 0.85

Tested by 1

_Function · 0.72