mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
Huge trailing whitespace cleanup. Let's keep the tree pure from here on,
mmmkay? git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1418 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
1a460ee40a
commit
521daf6f0a
283 changed files with 3742 additions and 3742 deletions
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
/***
|
||||
This file is part of PulseAudio.
|
||||
|
||||
|
||||
PulseAudio is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
|
||||
PulseAudio is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with PulseAudio; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
|
|
@ -71,7 +71,7 @@ struct memexport_slot {
|
|||
|
||||
struct pa_memexport {
|
||||
pa_mempool *pool;
|
||||
|
||||
|
||||
struct memexport_slot slots[PA_MEMEXPORT_SLOTS_MAX];
|
||||
PA_LLIST_HEAD(struct memexport_slot, free_slots);
|
||||
PA_LLIST_HEAD(struct memexport_slot, used_slots);
|
||||
|
|
@ -101,7 +101,7 @@ struct pa_mempool {
|
|||
|
||||
/* A list of free slots that may be reused */
|
||||
PA_LLIST_HEAD(struct mempool_slot, free_slots);
|
||||
|
||||
|
||||
pa_mempool_stat stat;
|
||||
};
|
||||
|
||||
|
|
@ -132,14 +132,14 @@ static void stat_remove(pa_memblock *b) {
|
|||
|
||||
assert(AO_load_acquire_read(&b->pool->stat.n_allocated) > 0);
|
||||
assert(AO_load_acquire_read(&b->pool->stat.allocated_size) >= (AO_t) b->length);
|
||||
|
||||
|
||||
AO_fetch_and_sub1_release_write(&b->pool->stat.n_allocated);
|
||||
AO_fetch_and_add_release_write(&b->pool->stat.allocated_size, (AO_t) (-b->length));
|
||||
|
||||
if (b->type == PA_MEMBLOCK_IMPORTED) {
|
||||
assert(AO_load_acquire_read(&b->pool->stat.n_imported) > 0);
|
||||
assert(AO_load_acquire_read(&b->pool->stat.imported_size) >= (AO_t) b->length);
|
||||
|
||||
|
||||
AO_fetch_and_sub1_release_write(&b->pool->stat.n_imported);
|
||||
AO_fetch_and_add_release_write(&b->pool->stat.imported_size, (AO_t) (-b->length));
|
||||
}
|
||||
|
|
@ -151,10 +151,10 @@ static pa_memblock *memblock_new_appended(pa_mempool *p, size_t length);
|
|||
|
||||
pa_memblock *pa_memblock_new(pa_mempool *p, size_t length) {
|
||||
pa_memblock *b;
|
||||
|
||||
|
||||
assert(p);
|
||||
assert(length > 0);
|
||||
|
||||
|
||||
if (!(b = pa_memblock_new_pool(p, length)))
|
||||
b = memblock_new_appended(p, length);
|
||||
|
||||
|
|
@ -231,16 +231,16 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) {
|
|||
|
||||
if (!(slot = mempool_allocate_slot(p)))
|
||||
return NULL;
|
||||
|
||||
|
||||
b = mempool_slot_data(slot);
|
||||
b->type = PA_MEMBLOCK_POOL;
|
||||
b->data = (uint8_t*) b + sizeof(pa_memblock);
|
||||
|
||||
|
||||
} else if (p->block_size - sizeof(struct mempool_slot) >= length) {
|
||||
|
||||
if (!(slot = mempool_allocate_slot(p)))
|
||||
return NULL;
|
||||
|
||||
|
||||
b = pa_xnew(pa_memblock, 1);
|
||||
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
|
||||
b->data = mempool_slot_data(slot);
|
||||
|
|
@ -285,7 +285,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, void (*
|
|||
assert(d);
|
||||
assert(length > 0);
|
||||
assert(free_cb);
|
||||
|
||||
|
||||
b = pa_xnew(pa_memblock, 1);
|
||||
b->type = PA_MEMBLOCK_USER;
|
||||
b->read_only = read_only;
|
||||
|
|
@ -313,7 +313,7 @@ void pa_memblock_unref(pa_memblock*b) {
|
|||
|
||||
if (PA_REFCNT_DEC(b) > 0)
|
||||
return;
|
||||
|
||||
|
||||
stat_remove(b);
|
||||
|
||||
switch (b->type) {
|
||||
|
|
@ -334,13 +334,13 @@ void pa_memblock_unref(pa_memblock*b) {
|
|||
segment = b->per_type.imported.segment;
|
||||
assert(segment);
|
||||
assert(segment->import);
|
||||
|
||||
|
||||
pa_hashmap_remove(segment->import->blocks, PA_UINT32_TO_PTR(b->per_type.imported.id));
|
||||
segment->import->release_cb(segment->import, b->per_type.imported.id, segment->import->userdata);
|
||||
|
||||
if (-- segment->n_blocks <= 0)
|
||||
segment_detach(segment);
|
||||
|
||||
|
||||
pa_xfree(b);
|
||||
break;
|
||||
}
|
||||
|
|
@ -351,9 +351,9 @@ void pa_memblock_unref(pa_memblock*b) {
|
|||
|
||||
slot = mempool_slot_by_ptr(b->pool, b->data);
|
||||
assert(slot);
|
||||
|
||||
|
||||
PA_LLIST_PREPEND(struct mempool_slot, b->pool->free_slots, slot);
|
||||
|
||||
|
||||
if (b->type == PA_MEMBLOCK_POOL_EXTERNAL)
|
||||
pa_xfree(b);
|
||||
|
||||
|
|
@ -377,7 +377,7 @@ static void memblock_make_local(pa_memblock *b) {
|
|||
if ((slot = mempool_allocate_slot(b->pool))) {
|
||||
void *new_data;
|
||||
/* We can move it into a local pool, perfect! */
|
||||
|
||||
|
||||
b->type = PA_MEMBLOCK_POOL_EXTERNAL;
|
||||
b->read_only = 0;
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ void pa_memblock_unref_fixed(pa_memblock *b) {
|
|||
|
||||
static void memblock_replace_import(pa_memblock *b) {
|
||||
pa_memimport_segment *seg;
|
||||
|
||||
|
||||
assert(b);
|
||||
assert(b->type == PA_MEMBLOCK_IMPORTED);
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ pa_mempool* pa_mempool_new(int shared) {
|
|||
|
||||
if (p->block_size < ps)
|
||||
p->block_size = ps;
|
||||
|
||||
|
||||
p->n_blocks = PA_MEMPOOL_SLOTS_MAX;
|
||||
|
||||
assert(p->block_size > sizeof(struct mempool_slot));
|
||||
|
|
@ -464,7 +464,7 @@ pa_mempool* pa_mempool_new(int shared) {
|
|||
}
|
||||
|
||||
p->n_init = 0;
|
||||
|
||||
|
||||
PA_LLIST_HEAD_INIT(pa_memimport, p->imports);
|
||||
PA_LLIST_HEAD_INIT(pa_memexport, p->exports);
|
||||
PA_LLIST_HEAD_INIT(struct mempool_slot, p->free_slots);
|
||||
|
|
@ -485,7 +485,7 @@ void pa_mempool_free(pa_mempool *p) {
|
|||
|
||||
if (AO_load_acquire_read(&p->stat.n_allocated) > 0)
|
||||
pa_log_warn("WARNING! Memory pool destroyed but not all memory blocks freed!");
|
||||
|
||||
|
||||
pa_shm_free(&p->memory);
|
||||
pa_xfree(p);
|
||||
}
|
||||
|
|
@ -498,7 +498,7 @@ const pa_mempool_stat* pa_mempool_get_stat(pa_mempool *p) {
|
|||
|
||||
void pa_mempool_vacuum(pa_mempool *p) {
|
||||
struct mempool_slot *slot;
|
||||
|
||||
|
||||
assert(p);
|
||||
|
||||
for (slot = p->free_slots; slot; slot = slot->next)
|
||||
|
|
@ -512,7 +512,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) {
|
|||
return -1;
|
||||
|
||||
*id = p->memory.id;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -528,14 +528,14 @@ pa_memimport* pa_memimport_new(pa_mempool *p, pa_memimport_release_cb_t cb, void
|
|||
|
||||
assert(p);
|
||||
assert(cb);
|
||||
|
||||
|
||||
i = pa_xnew(pa_memimport, 1);
|
||||
i->pool = p;
|
||||
i->segments = pa_hashmap_new(NULL, NULL);
|
||||
i->blocks = pa_hashmap_new(NULL, NULL);
|
||||
i->release_cb = cb;
|
||||
i->userdata = userdata;
|
||||
|
||||
|
||||
PA_LLIST_PREPEND(pa_memimport, p->imports, i);
|
||||
return i;
|
||||
}
|
||||
|
|
@ -549,7 +549,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
|
|||
return NULL;
|
||||
|
||||
seg = pa_xnew(pa_memimport_segment, 1);
|
||||
|
||||
|
||||
if (pa_shm_attach_ro(&seg->memory, shm_id) < 0) {
|
||||
pa_xfree(seg);
|
||||
return NULL;
|
||||
|
|
@ -557,7 +557,7 @@ static pa_memimport_segment* segment_attach(pa_memimport *i, uint32_t shm_id) {
|
|||
|
||||
seg->import = i;
|
||||
seg->n_blocks = 0;
|
||||
|
||||
|
||||
pa_hashmap_put(i->segments, PA_UINT32_TO_PTR(shm_id), seg);
|
||||
return seg;
|
||||
}
|
||||
|
|
@ -573,7 +573,7 @@ static void segment_detach(pa_memimport_segment *seg) {
|
|||
void pa_memimport_free(pa_memimport *i) {
|
||||
pa_memexport *e;
|
||||
pa_memblock *b;
|
||||
|
||||
|
||||
assert(i);
|
||||
|
||||
/* If we've exported this block further we need to revoke that export */
|
||||
|
|
@ -587,7 +587,7 @@ void pa_memimport_free(pa_memimport *i) {
|
|||
|
||||
pa_hashmap_free(i->blocks, NULL, NULL);
|
||||
pa_hashmap_free(i->segments, NULL, NULL);
|
||||
|
||||
|
||||
PA_LLIST_REMOVE(pa_memimport, i->pool->imports, i);
|
||||
pa_xfree(i);
|
||||
}
|
||||
|
|
@ -595,19 +595,19 @@ void pa_memimport_free(pa_memimport *i) {
|
|||
pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_id, size_t offset, size_t size) {
|
||||
pa_memblock *b;
|
||||
pa_memimport_segment *seg;
|
||||
|
||||
|
||||
assert(i);
|
||||
|
||||
if (pa_hashmap_size(i->blocks) >= PA_MEMIMPORT_SLOTS_MAX)
|
||||
return NULL;
|
||||
|
||||
if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
|
||||
if (!(seg = pa_hashmap_get(i->segments, PA_UINT32_TO_PTR(shm_id))))
|
||||
if (!(seg = segment_attach(i, shm_id)))
|
||||
return NULL;
|
||||
|
||||
if (offset+size > seg->memory.size)
|
||||
return NULL;
|
||||
|
||||
|
||||
b = pa_xnew(pa_memblock, 1);
|
||||
b->type = PA_MEMBLOCK_IMPORTED;
|
||||
b->read_only = 1;
|
||||
|
|
@ -621,9 +621,9 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i
|
|||
pa_hashmap_put(i->blocks, PA_UINT32_TO_PTR(block_id), b);
|
||||
|
||||
seg->n_blocks++;
|
||||
|
||||
|
||||
stat_add(b);
|
||||
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
@ -633,7 +633,7 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
|
|||
|
||||
if (!(b = pa_hashmap_get(i->blocks, PA_UINT32_TO_PTR(id))))
|
||||
return -1;
|
||||
|
||||
|
||||
memblock_replace_import(b);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -641,13 +641,13 @@ int pa_memimport_process_revoke(pa_memimport *i, uint32_t id) {
|
|||
/* For sending blocks to other nodes */
|
||||
pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void *userdata) {
|
||||
pa_memexport *e;
|
||||
|
||||
|
||||
assert(p);
|
||||
assert(cb);
|
||||
|
||||
if (!p->memory.shared)
|
||||
return NULL;
|
||||
|
||||
|
||||
e = pa_xnew(pa_memexport, 1);
|
||||
e->pool = p;
|
||||
PA_LLIST_HEAD_INIT(struct memexport_slot, e->free_slots);
|
||||
|
|
@ -655,7 +655,7 @@ pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void
|
|||
e->n_init = 0;
|
||||
e->revoke_cb = cb;
|
||||
e->userdata = userdata;
|
||||
|
||||
|
||||
PA_LLIST_PREPEND(pa_memexport, p->exports, e);
|
||||
return e;
|
||||
}
|
||||
|
|
@ -683,10 +683,10 @@ int pa_memexport_process_release(pa_memexport *e, uint32_t id) {
|
|||
|
||||
assert(AO_load_acquire_read(&e->pool->stat.n_exported) > 0);
|
||||
assert(AO_load_acquire_read(&e->pool->stat.exported_size) >= (AO_t) e->slots[id].block->length);
|
||||
|
||||
|
||||
AO_fetch_and_sub1_release_write(&e->pool->stat.n_exported);
|
||||
AO_fetch_and_add_release_write(&e->pool->stat.exported_size, (AO_t) -e->slots[id].block->length);
|
||||
|
||||
|
||||
pa_memblock_unref(e->slots[id].block);
|
||||
e->slots[id].block = NULL;
|
||||
|
||||
|
|
@ -704,7 +704,7 @@ static void memexport_revoke_blocks(pa_memexport *e, pa_memimport *i) {
|
|||
for (slot = e->used_slots; slot; slot = next) {
|
||||
uint32_t idx;
|
||||
next = slot->next;
|
||||
|
||||
|
||||
if (slot->block->type != PA_MEMBLOCK_IMPORTED ||
|
||||
slot->block->per_type.imported.segment->import != i)
|
||||
continue;
|
||||
|
|
@ -720,7 +720,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
|
|||
|
||||
assert(p);
|
||||
assert(b);
|
||||
|
||||
|
||||
if (b->type == PA_MEMBLOCK_IMPORTED ||
|
||||
b->type == PA_MEMBLOCK_POOL ||
|
||||
b->type == PA_MEMBLOCK_POOL_EXTERNAL) {
|
||||
|
|
@ -738,7 +738,7 @@ static pa_memblock *memblock_shared_copy(pa_mempool *p, pa_memblock *b) {
|
|||
int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32_t *shm_id, size_t *offset, size_t * size) {
|
||||
pa_shm *memory;
|
||||
struct memexport_slot *slot;
|
||||
|
||||
|
||||
assert(e);
|
||||
assert(b);
|
||||
assert(block_id);
|
||||
|
|
@ -774,10 +774,10 @@ int pa_memexport_put(pa_memexport *e, pa_memblock *b, uint32_t *block_id, uint32
|
|||
assert(b->pool);
|
||||
memory = &b->pool->memory;
|
||||
}
|
||||
|
||||
|
||||
assert(b->data >= memory->ptr);
|
||||
assert((uint8_t*) b->data + b->length <= (uint8_t*) memory->ptr + memory->size);
|
||||
|
||||
|
||||
*shm_id = memory->id;
|
||||
*offset = (uint8_t*) b->data - (uint8_t*) memory->ptr;
|
||||
*size = b->length;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue