mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
Fix typo in pa_memblock_release() call; s/assert/pa_assert/
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1522 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
65d54d6aaf
commit
2a19c466bc
1 changed files with 12 additions and 12 deletions
|
|
@ -23,11 +23,11 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <pulsecore/memblock.h>
|
#include <pulsecore/memblock.h>
|
||||||
|
#include <pulsecore/macro.h>
|
||||||
#include <pulse/xmalloc.h>
|
#include <pulse/xmalloc.h>
|
||||||
|
|
||||||
static void release_cb(pa_memimport *i, uint32_t block_id, void *userdata) {
|
static void release_cb(pa_memimport *i, uint32_t block_id, void *userdata) {
|
||||||
|
|
@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
|
||||||
pa_mempool_get_shm_id(pool_b, &id_b);
|
pa_mempool_get_shm_id(pool_b, &id_b);
|
||||||
pa_mempool_get_shm_id(pool_c, &id_c);
|
pa_mempool_get_shm_id(pool_c, &id_c);
|
||||||
|
|
||||||
assert(pool_a && pool_b && pool_c);
|
pa_assert(pool_a && pool_b && pool_c);
|
||||||
|
|
||||||
blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
|
blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
|
||||||
|
|
||||||
|
|
@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
|
||||||
blocks[2] = pa_memblock_new_pool(pool_a, sizeof(txt));
|
blocks[2] = pa_memblock_new_pool(pool_a, sizeof(txt));
|
||||||
x = pa_memblock_acquire(blocks[2]);
|
x = pa_memblock_acquire(blocks[2]);
|
||||||
snprintf(x, pa_memblock_get_length(blocks[2]), "%s", txt);
|
snprintf(x, pa_memblock_get_length(blocks[2]), "%s", txt);
|
||||||
pa_memblock_release(blocks[1]);
|
pa_memblock_release(blocks[2]);
|
||||||
|
|
||||||
blocks[3] = pa_memblock_new_malloced(pool_a, pa_xstrdup(txt), sizeof(txt));
|
blocks[3] = pa_memblock_new_malloced(pool_a, pa_xstrdup(txt), sizeof(txt));
|
||||||
blocks[4] = NULL;
|
blocks[4] = NULL;
|
||||||
|
|
@ -109,35 +109,35 @@ int main(int argc, char *argv[]) {
|
||||||
printf("Memory block %u\n", i);
|
printf("Memory block %u\n", i);
|
||||||
|
|
||||||
mb_a = blocks[i];
|
mb_a = blocks[i];
|
||||||
assert(mb_a);
|
pa_assert(mb_a);
|
||||||
|
|
||||||
export_a = pa_memexport_new(pool_a, revoke_cb, (void*) "A");
|
export_a = pa_memexport_new(pool_a, revoke_cb, (void*) "A");
|
||||||
export_b = pa_memexport_new(pool_b, revoke_cb, (void*) "B");
|
export_b = pa_memexport_new(pool_b, revoke_cb, (void*) "B");
|
||||||
|
|
||||||
assert(export_a && export_b);
|
pa_assert(export_a && export_b);
|
||||||
|
|
||||||
import_b = pa_memimport_new(pool_b, release_cb, (void*) "B");
|
import_b = pa_memimport_new(pool_b, release_cb, (void*) "B");
|
||||||
import_c = pa_memimport_new(pool_c, release_cb, (void*) "C");
|
import_c = pa_memimport_new(pool_c, release_cb, (void*) "C");
|
||||||
|
|
||||||
assert(import_b && import_c);
|
pa_assert(import_b && import_c);
|
||||||
|
|
||||||
r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size);
|
r = pa_memexport_put(export_a, mb_a, &id, &shm_id, &offset, &size);
|
||||||
assert(r >= 0);
|
pa_assert(r >= 0);
|
||||||
assert(shm_id == id_a);
|
pa_assert(shm_id == id_a);
|
||||||
|
|
||||||
printf("A: Memory block exported as %u\n", id);
|
printf("A: Memory block exported as %u\n", id);
|
||||||
|
|
||||||
mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
|
mb_b = pa_memimport_get(import_b, id, shm_id, offset, size);
|
||||||
assert(mb_b);
|
pa_assert(mb_b);
|
||||||
r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size);
|
r = pa_memexport_put(export_b, mb_b, &id, &shm_id, &offset, &size);
|
||||||
assert(r >= 0);
|
pa_assert(r >= 0);
|
||||||
assert(shm_id == id_a || shm_id == id_b);
|
pa_assert(shm_id == id_a || shm_id == id_b);
|
||||||
pa_memblock_unref(mb_b);
|
pa_memblock_unref(mb_b);
|
||||||
|
|
||||||
printf("B: Memory block exported as %u\n", id);
|
printf("B: Memory block exported as %u\n", id);
|
||||||
|
|
||||||
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
|
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
|
||||||
assert(mb_c);
|
pa_assert(mb_c);
|
||||||
x = pa_memblock_acquire(mb_c);
|
x = pa_memblock_acquire(mb_c);
|
||||||
printf("1 data=%s\n", x);
|
printf("1 data=%s\n", x);
|
||||||
pa_memblock_release(mb_c);
|
pa_memblock_release(mb_c);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue