MCPcopy Create free account
hub / github.com/acidanthera/BrcmPatchRAM / z_alloc

Function z_alloc

BrcmPatchRAM/BrcmFirmwareStore.cpp:51–67  ·  view source on GitHub ↗

* Space allocation and freeing routines for use by zlib routines. */

Source from the content-addressed store, hash-verified

49 * Space allocation and freeing routines for use by zlib routines.
50 */
51 void* z_alloc(void* notused __unused, u_int num_items, u_int size)
52 {
53 void* result = NULL;
54 z_mem* zmem = NULL;
55 UInt32 total = num_items * size;
56 UInt32 allocSize = total + sizeof(zmem);
57
58 zmem = (z_mem*)IOMalloc(allocSize);
59
60 if (zmem)
61 {
62 zmem->alloc_size = allocSize;
63 result = (void*)&(zmem->data);
64 }
65
66 return result;
67 }
68
69 void z_free(void* notused __unused, void* ptr)
70 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected