| 90 | } |
| 91 | |
| 92 | void |
| 93 | pool_destroy(alloc_pool_t p) |
| 94 | { |
| 95 | struct alloc_pool *pool = (struct alloc_pool *) p; |
| 96 | struct pool_extent *cur, *next; |
| 97 | |
| 98 | if (!pool) |
| 99 | return; |
| 100 | |
| 101 | for (cur = pool->extents; cur; cur = next) { |
| 102 | next = cur->next; |
| 103 | if (pool->flags & POOL_PREPEND) |
| 104 | free(PTR_SUB(cur->start, sizeof (struct pool_extent))); |
| 105 | else { |
| 106 | free(cur->start); |
| 107 | free(cur); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | free(pool); |
| 112 | } |
| 113 | |
| 114 | void * |
| 115 | pool_alloc(alloc_pool_t p, size_t len, const char *bomb_msg) |