summaryrefslogtreecommitdiffstats
path: root/src/tests/memblock-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/memblock-test.c')
-rw-r--r--src/tests/memblock-test.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c
index c2dd2efa..ef2e0ad7 100644
--- a/src/tests/memblock-test.c
+++ b/src/tests/memblock-test.c
@@ -76,7 +76,6 @@ int main(int argc, char *argv[]) {
pa_memblock* blocks[5];
uint32_t id, shm_id;
size_t offset, size;
- char *x;
const char txt[] = "This is a test!";
@@ -91,17 +90,10 @@ int main(int argc, char *argv[]) {
assert(pool_a && pool_b && pool_c);
blocks[0] = pa_memblock_new_fixed(pool_a, (void*) txt, sizeof(txt), 1);
-
blocks[1] = pa_memblock_new(pool_a, sizeof(txt));
- x = pa_memblock_acquire(blocks[1]);
- snprintf(x, pa_memblock_get_length(blocks[1]), "%s", txt);
- pa_memblock_release(blocks[1]);
-
+ snprintf(blocks[1]->data, blocks[1]->length, "%s", txt);
blocks[2] = pa_memblock_new_pool(pool_a, sizeof(txt));
- x = pa_memblock_acquire(blocks[2]);
- snprintf(x, pa_memblock_get_length(blocks[2]), "%s", txt);
- pa_memblock_release(blocks[1]);
-
+ snprintf(blocks[2]->data, blocks[2]->length, "%s", txt);
blocks[3] = pa_memblock_new_malloced(pool_a, pa_xstrdup(txt), sizeof(txt));
blocks[4] = NULL;
@@ -138,18 +130,14 @@ int main(int argc, char *argv[]) {
mb_c = pa_memimport_get(import_c, id, shm_id, offset, size);
assert(mb_c);
- x = pa_memblock_acquire(mb_c);
- printf("1 data=%s\n", x);
- pa_memblock_release(mb_c);
+ printf("1 data=%s\n", (char*) mb_c->data);
print_stats(pool_a, "A");
print_stats(pool_b, "B");
print_stats(pool_c, "C");
pa_memexport_free(export_b);
- x = pa_memblock_acquire(mb_c);
- printf("2 data=%s\n", x);
- pa_memblock_release(mb_c);
+ printf("2 data=%s\n", (char*) mb_c->data);
pa_memblock_unref(mb_c);
pa_memimport_free(import_b);