summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-04-22 00:52:31 +0000
committerLennart Poettering <lennart@poettering.net>2008-04-22 00:52:31 +0000
commit88227c41c1dc9505b043b6a37ca86eaafe5b549f (patch)
tree7bd79107cbad1abf3ec3e115d0d4c2c24a7ea6bf
parent5e7e827be5988db0262830886c7c9213fe45b554 (diff)
properly initialize memblock->is_silence for imported memory blocks; make is_silence and read_only a bit field
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2290 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulsecore/memblock.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index c452ae0b..46537795 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -59,7 +59,7 @@ struct pa_memblock {
pa_mempool *pool;
pa_memblock_type_t type;
- pa_bool_t read_only, is_silence;
+ pa_bool_t read_only:1, is_silence:1;
pa_atomic_ptr_t data;
size_t length;
@@ -226,8 +226,7 @@ static pa_memblock *memblock_new_appended(pa_mempool *p, size_t length) {
PA_REFCNT_INIT(b);
b->pool = p;
b->type = PA_MEMBLOCK_APPENDED;
- b->read_only = FALSE;
- b->is_silence = FALSE;
+ b->read_only = b->is_silence = FALSE;
pa_atomic_ptr_store(&b->data, (uint8_t*) b + PA_ALIGN(sizeof(pa_memblock)));
b->length = length;
pa_atomic_store(&b->n_acquired, 0);
@@ -331,8 +330,7 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) {
PA_REFCNT_INIT(b);
b->pool = p;
- b->read_only = FALSE;
- b->is_silence = FALSE;
+ b->read_only = b->is_silence = FALSE;
b->length = length;
pa_atomic_store(&b->n_acquired, 0);
pa_atomic_store(&b->please_signal, 0);
@@ -598,7 +596,7 @@ static void memblock_make_local(pa_memblock *b) {
pa_atomic_ptr_store(&b->data, new_data);
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
- b->read_only = 0;
+ b->read_only = FALSE;
goto finish;
}
@@ -609,7 +607,7 @@ static void memblock_make_local(pa_memblock *b) {
pa_atomic_ptr_store(&b->data, pa_xmemdup(pa_atomic_ptr_load(&b->data), b->length));
b->type = PA_MEMBLOCK_USER;
- b->read_only = 0;
+ b->read_only = FALSE;
finish:
pa_atomic_inc(&b->pool->stat.n_allocated_by_type[b->type]);
@@ -905,7 +903,8 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
PA_REFCNT_INIT(b);
b->pool = i->pool;
b->type = PA_MEMBLOCK_IMPORTED;
- b->read_only = 1;
+ b->read_only = TRUE;
+ b->is_silence = FALSE;
pa_atomic_ptr_store(&b->data, (uint8_t*) seg->memory.ptr + offset);
b->length = size;
pa_atomic_store(&b->n_acquired, 0);