Lines Matching defs:pool
13 * New (version 1.4) buffer pool implementation.
15 * Now, each buffer in the pool can be a different size.
20 * really wasn't good for anything since we always grew the buffer pool
25 * more than about 10-15 buffers in the pool, that's OK. A binary tree
28 * MCH: BufferPoolPop will now return the smallest buffer in the pool that
56 crBufferPoolGetNumBuffers( CRBufferPool *pool )
58 if ( pool )
59 return pool->numBuffers;
64 crBufferPoolGetMaxBuffers( CRBufferPool *pool )
66 if ( pool )
67 return pool->maxBuffers;
74 CRBufferPool *pool = crCalloc(sizeof(CRBufferPool));
75 if (pool) {
76 pool->head = NULL;
77 pool->maxBuffers = maxBuffers;
78 pool->numBuffers = 0;
80 return pool;
84 crBufferPoolFree( CRBufferPool *pool )
88 for (b = pool->head; b; b = next) {
96 crBufferPoolCallbackFree(CRBufferPool *pool, CRBufferPoolDeleteCallback pfnDelete)
102 for (b = pool->head; b; b = next) {
110 crBufferPoolPush( CRBufferPool *pool, void *buf, unsigned int bytes )
115 /* check that the buffer to push isn't already in the pool! */
118 for (b = pool->head; b; b = b->next) {
126 b->next = pool->head;
127 pool->head = b;
128 pool->numBuffers++;
133 crBufferPoolPop( CRBufferPool *pool, unsigned int bytes )
141 for (b = pool->head, i=0; i<pool->numBuffers; b = b->next, i++) {
149 pool->head = b->next;
152 pool->numBuffers--;
153 CRASSERT(pool->numBuffers >= 0);
175 b = pool->head;
184 pool->head = b->next;
187 pool->numBuffers--;
188 CRASSERT(pool->numBuffers >= 0);