Changeset 2963 for pjproject/trunk/pjlib/src/pj/pool.c
- Timestamp:
- Oct 24, 2009 2:06:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/pool.c
r2394 r2963 67 67 pool->capacity += size; 68 68 69 /* Set block attribytes. */70 block-> cur = block->buf = ((unsigned char*)block) + sizeof(pj_pool_block);69 /* Set start and end of buffer. */ 70 block->buf = ((unsigned char*)block) + sizeof(pj_pool_block); 71 71 block->end = ((unsigned char*)block) + size; 72 73 /* Set the start pointer, aligning it as needed */ 74 block->cur = (unsigned char*) 75 (((unsigned long)block->buf + PJ_POOL_ALIGNMENT - 1) & 76 ~(PJ_POOL_ALIGNMENT - 1)); 72 77 73 78 /* Insert in the front of the list. */ … … 112 117 /* If pool is configured to expand, but the increment size 113 118 * is less than the required size, expand the pool by multiple 114 * increment size 119 * increment size. Also count the size wasted due to aligning 120 * the block. 115 121 */ 116 if (pool->increment_size < size + sizeof(pj_pool_block)) { 122 if (pool->increment_size < 123 size + sizeof(pj_pool_block) + PJ_POOL_ALIGNMENT) 124 { 117 125 unsigned count; 118 count = (size + pool->increment_size + sizeof(pj_pool_block)) / 126 count = (size + pool->increment_size + sizeof(pj_pool_block) + 127 PJ_POOL_ALIGNMENT) / 119 128 pool->increment_size; 120 129 block_size = count * pool->increment_size;
Note: See TracChangeset
for help on using the changeset viewer.