MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / qm_insert_free

Function qm_insert_free

mem/q_malloc.c:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158static inline void qm_insert_free(struct qm_block *qm, struct qm_frag *frag)
159{
160 struct qm_frag *f;
161 struct qm_frag *prev;
162 int hash;
163
164 hash=GET_HASH(frag->size);
165 for(f=qm->free_hash[hash].head.u.nxt_free; f!=&(qm->free_hash[hash].head);
166 f=f->u.nxt_free){
167 if (frag->size <= f->size) break;
168 }
169 /*insert it here*/
170 prev=FRAG_END(f)->prev_free;
171 prev->u.nxt_free=frag;
172 FRAG_END(frag)->prev_free=prev;
173 frag->u.nxt_free=f;
174 FRAG_END(f)->prev_free=frag;
175 qm->free_hash[hash].no++;
176
177 qm->real_used-=frag->size;
178#if defined(DBG_MALLOC) || defined(STATISTICS)
179 qm->used-=frag->size;
180#endif
181}
182
183
184/* init malloc and return a qm_block*/

Callers 3

q_malloc_dyn.hFile · 0.85
qm_freeFunction · 0.85
qm_malloc_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected