memblock: make it easy to disable mempool usage with $PULSE_MEMPOOL_DISABLE

This commit is contained in:
Lennart Poettering 2009-09-17 01:21:56 +02:00
parent 6b8fdc4169
commit e2899f8bf3

View file

@ -303,10 +303,17 @@ static struct mempool_slot* mempool_slot_by_ptr(pa_mempool *p, void *ptr) {
pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) { pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) {
pa_memblock *b = NULL; pa_memblock *b = NULL;
struct mempool_slot *slot; struct mempool_slot *slot;
static int mempool_disable = 0;
pa_assert(p); pa_assert(p);
pa_assert(length); pa_assert(length);
if (mempool_disable == 0)
mempool_disable = getenv("PULSE_MEMPOOL_DISABLE") ? 1 : -1;
if (mempool_disable > 0)
return NULL;
/* If -1 is passed as length we choose the size for the caller: we /* If -1 is passed as length we choose the size for the caller: we
* take the largest size that fits in one of our slots. */ * take the largest size that fits in one of our slots. */