MCPcopy Index your code
hub / github.com/F-Stack/f-stack / HeapResize

Method HeapResize

adapter/micro_thread/heap.h:118–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116 };
117
118 int HeapResize(int size) {
119 if (_max >= size) {
120 return 0;
121 }
122
123 HeapEntry** new_list = (HeapEntry**)malloc(sizeof(HeapEntry*) * (size+1));
124 if (NULL == new_list) {
125 return -1;
126 }
127 memset(new_list, 0, sizeof(HeapEntry*) * (size+1));
128 memcpy(new_list, _list, sizeof(HeapEntry*) * (_max+1));
129 free(_list);
130 _list = new_list;
131 _max = size;
132
133 return 0;
134 };
135
136
137 int HeapPush(HeapEntry* entry);

Callers 1

InitFrameMethod · 0.80

Calls 4

mallocFunction · 0.85
memsetFunction · 0.85
memcpyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected