MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / pqueue_insert

Function pqueue_insert

libCacheSim/dataStructure/pqueue.c:155–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154
155int
156pqueue_insert(pqueue_t *q, void *d)
157{
158 void *tmp;
159 size_t i;
160 size_t newsize;
161
162 if (!q) return 1;
163
164 /* allocate more memory if necessary */
165 if (q->size >= q->avail) {
166 newsize = q->size + q->step;
167 if (!(tmp = realloc(q->d, sizeof(void *) * newsize)))
168 return 1;
169 q->d = tmp;
170 q->avail = newsize;
171 }
172
173 /* insert obj_id */
174 i = q->size++;
175 q->d[i] = d;
176 bubble_up(q, i);
177
178 return 0;
179}
180
181
182void

Callers 4

Size_insertFunction · 0.85
Belady_insertFunction · 0.85
_PG_add_to_graphFunction · 0.85
_PG_get_prefetch_listFunction · 0.85

Calls 1

bubble_upFunction · 0.85

Tested by

no test coverage detected