MCPcopy Create free account
hub / github.com/acl-dev/acl / realloc

Function realloc

test/libmm/memalloc.cpp:140–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void *realloc(void *block, size_t size)
141{
142 header_t *header;
143 void *ret;
144 if (!block || !size)
145 return mymalloc(size);
146 header = (header_t*)block - 1;
147 if (header->s.size >= size)
148 return block;
149 ret = mymalloc(size);
150 if (ret) {
151 /* Relocate contents to the new bigger block */
152 memcpy(ret, block, header->s.size);
153 /* Free the old memory block */
154 free(block);
155 }
156 return ret;
157}
158
159/* A debug function to print the entire link list */
160void print_mem_list()

Callers 8

mem_reallocFunction · 0.85
get_bufFunction · 0.85
acl_default_reallocFunction · 0.85
acl_debug_reallocFunction · 0.85
private_array_growFunction · 0.85
handle_pkgMethod · 0.85
pushMethod · 0.85
pushMethod · 0.85

Calls 3

mymallocFunction · 0.85
memcpyFunction · 0.85
freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…