]> code.delx.au - pulseaudio/commitdiff
memblock: make it easy to disable mempool usage with $PULSE_MEMPOOL_DISABLE
authorLennart Poettering <lennart@poettering.net>
Wed, 16 Sep 2009 23:21:56 +0000 (01:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 16 Sep 2009 23:21:56 +0000 (01:21 +0200)
src/pulsecore/memblock.c

index 0e40d12b7230e2194d3c262e9ac3625ebdccab80..47f298a4bbfb81371b1d763cd20a9a034afb6598 100644 (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 *b = NULL;
     struct mempool_slot *slot;
+    static int mempool_disable = 0;
 
     pa_assert(p);
     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
      * take the largest size that fits in one of our slots. */