Lines Matching defs:pool

600 /* The following is a pool of memory allocated by a single libpng read or write
704 store_pool_init(png_store *ps, store_pool *pool)
706 memset(pool, 0, sizeof *pool);
708 pool->store = ps;
709 pool->list = NULL;
710 pool->max = pool->current = pool->limit = pool->total = 0;
711 pool->max_max = pool->max_limit = pool->max_total = 0;
712 store_pool_mark(pool->mark);
1294 store_pool *pool; /* Originating pool */
1321 store_memory_free(png_const_structp pp, store_pool *pool, store_memory *memory)
1324 * found 'memory' in pool->list *and* unlinked this entry, so this is a valid
1327 if (memory->pool != pool)
1328 store_pool_error(pool->store, pp, "memory corrupted (pool)");
1330 else if (memcmp(memory->mark, pool->mark, sizeof memory->mark) != 0)
1331 store_pool_error(pool->store, pp, "memory corrupted (start)");
1338 if (cb > pool->max)
1339 store_pool_error(pool->store, pp, "memory corrupted (size)");
1341 else if (memcmp((png_bytep)(memory+1)+cb, pool->mark, sizeof pool->mark)
1343 store_pool_error(pool->store, pp, "memory corrupted (end)");
1348 pool->current -= cb;
1355 store_pool_delete(png_store *ps, store_pool *pool)
1357 if (pool->list != NULL)
1360 pool == &ps->read_memory_pool ? "read" : "write",
1361 pool == &ps->read_memory_pool ? (ps->current != NULL ?
1367 store_memory *next = pool->list;
1368 pool->list = next->next;
1376 store_memory_free(NULL, pool, next);
1378 while (pool->list != NULL);
1382 if (pool->max > pool->max_max) pool->max_max = pool->max;
1383 pool->max = 0;
1384 if (pool->current != 0) /* unexpected internal error */
1386 ps->test, pool == &ps->read_memory_pool ? "read" : "write",
1387 pool == &ps->read_memory_pool ? (ps->current != NULL ?
1389 pool->current = 0;
1391 if (pool->limit > pool->max_limit)
1392 pool->max_limit = pool->limit;
1394 pool->limit = 0;
1396 if (pool->total > pool->max_total)
1397 pool->max_total = pool->total;
1399 pool->total = 0;
1402 store_pool_mark(pool->mark);
1410 store_pool *pool = voidcast(store_pool*, png_get_mem_ptr(pp));
1412 (sizeof pool->mark)));
1416 if (cb > pool->max)
1417 pool->max = cb;
1419 pool->current += cb;
1421 if (pool->current > pool->limit)
1422 pool->limit = pool->current;
1424 pool->total += cb;
1427 memcpy(new->mark, pool->mark, sizeof new->mark);
1428 memcpy((png_byte*)(new+1) + cb, pool->mark, sizeof pool->mark);
1429 new->pool = pool;
1430 new->next = pool->list;
1431 pool->list = new;
1449 store_log(pool->store, pp, "out of memory", 1 /* is_error */);
1459 store_pool *pool = voidcast(store_pool*, png_get_mem_ptr(pp));
1467 if (pp != pool->store->pread && pp != pool->store->pwrite)
1471 * pool list. If it is, use the shared memory_free function to free it.
1474 for (test = &pool->list; *test != this; test = &(*test)->next)
1478 store_pool_error(pool->store, pp, "bad pointer to free");
1486 store_memory_free(pp, pool, this);