If the current extent doesn't have "len" free space in it, mark it as full * so that the next alloc will start a new extent. If len is (size_t)-1, this * bump will always occur. The function returns a boundary address that can * be used with pool_free_old(), or a NULL if no memory is allocated. */
| 307 | * bump will always occur. The function returns a boundary address that can |
| 308 | * be used with pool_free_old(), or a NULL if no memory is allocated. */ |
| 309 | void * |
| 310 | pool_boundary(alloc_pool_t p, size_t len) |
| 311 | { |
| 312 | struct alloc_pool *pool = (struct alloc_pool *)p; |
| 313 | struct pool_extent *cur; |
| 314 | |
| 315 | if (!pool || !pool->extents) |
| 316 | return NULL; |
| 317 | |
| 318 | cur = pool->extents; |
| 319 | |
| 320 | if (cur->free < len) { |
| 321 | cur->bound += cur->free; |
| 322 | cur->free = 0; |
| 323 | } |
| 324 | |
| 325 | return PTR_ADD(cur->start, cur->free); |
| 326 | } |
| 327 | |
| 328 | #define FDPRINT(label, value) \ |
| 329 | do { \ |
no outgoing calls
no test coverage detected