- struct alloc_pool *pool;
-
- if (!(pool = new(struct alloc_pool)))
- return pool;
- memset(pool, 0, sizeof (struct alloc_pool));
-
- pool->size = size /* round extent size to min alignment reqs */
- ? (size + MINALIGN - 1) & ~(MINALIGN - 1)
- : POOL_DEF_EXTENT;
- if (pool->flags & POOL_INTERN) {
- pool->size -= sizeof (struct pool_extent);
- flags |= POOL_APPEND;
+ struct alloc_pool *pool;
+
+ if (!(pool = new0(struct alloc_pool)))
+ return NULL;
+
+ if ((MINALIGN & (MINALIGN - 1)) != 0) {
+ if (bomb)
+ (*bomb)("Compiler error: MINALIGN is not a power of 2\n");
+ return NULL;
+ }
+
+ if (!size)
+ size = POOL_DEF_EXTENT;
+ if (!quantum)
+ quantum = MINALIGN;
+
+ if (flags & POOL_INTERN) {
+ if (size <= sizeof (struct pool_extent))
+ size = quantum;
+ else
+ size -= sizeof (struct pool_extent);
+ flags |= POOL_PREPEND;