Lines Matching full:mp
88 znalloc(MemPool *mp, uintptr_t bytes, size_t align) in znalloc() argument
108 if (bytes > mp->mp_Size - mp->mp_Used) in znalloc()
111 for (pmn = &mp->mp_First; (mn = *pmn) != NULL; pmn = &mn->mr_Next) { in znalloc()
156 mp->mp_Used += bytes; in znalloc()
172 zfree(MemPool *mp, void *ptr, uintptr_t bytes) in zfree() argument
190 if ((char *)ptr < (char *)mp->mp_Base || in zfree()
191 (char *)ptr + bytes > (char *)mp->mp_End || in zfree()
198 mp->mp_Used -= bytes; in zfree()
200 for (pmn = &mp->mp_First; (mn = *pmn) != NULL; pmn = &mn->mr_Next) { in zfree()
235 if (pmn != &mp->mp_First) { in zfree()
255 if (pmn == &mp->mp_First || in zfree()
279 zextendPool(MemPool *mp, void *base, uintptr_t bytes) in zextendPool() argument
281 if (mp->mp_Size == 0) { in zextendPool()
282 mp->mp_Base = base; in zextendPool()
283 mp->mp_Used = bytes; in zextendPool()
284 mp->mp_End = (char *)base + bytes; in zextendPool()
285 mp->mp_Size = bytes; in zextendPool()
287 void *pend = (char *)mp->mp_Base + mp->mp_Size; in zextendPool()
289 if (base < mp->mp_Base) { in zextendPool()
290 mp->mp_Size += (char *)mp->mp_Base - (char *)base; in zextendPool()
291 mp->mp_Used += (char *)mp->mp_Base - (char *)base; in zextendPool()
292 mp->mp_Base = base; in zextendPool()
296 mp->mp_Size += (char *)base - (char *)pend; in zextendPool()
297 mp->mp_Used += (char *)base - (char *)pend; in zextendPool()
298 mp->mp_End = (char *)base; in zextendPool()
306 zallocstats(MemPool *mp) in zallocstats() argument
313 printf("%d bytes reserved", (int)mp->mp_Size); in zallocstats()
315 mn = mp->mp_First; in zallocstats()
317 if ((void *)mn != (void *)mp->mp_Base) { in zallocstats()
318 abytes += (char *)mn - (char *)mp->mp_Base; in zallocstats()
322 if ((char *)mn + mn->mr_Bytes != mp->mp_End) { in zallocstats()