summaryrefslogtreecommitdiffstats
path: root/polyp/memchunk.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-08-17 19:37:29 +0000
committerLennart Poettering <lennart@poettering.net>2004-08-17 19:37:29 +0000
commite75b65715b2fc9a3363bd4ac598fe02888b7ed21 (patch)
tree4143a433981356e6a784ecf0a0c0bfc3806348ea /polyp/memchunk.c
parent81822a751929fbc153282de3af447b9430d5c474 (diff)
remove global memblock statistic variables in favor of memblock_stat objects
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@137 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/memchunk.c')
-rw-r--r--polyp/memchunk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/polyp/memchunk.c b/polyp/memchunk.c
index 77e1b7dd..5913c6e3 100644
--- a/polyp/memchunk.c
+++ b/polyp/memchunk.c
@@ -31,14 +31,14 @@
#include "memchunk.h"
#include "xmalloc.h"
-void pa_memchunk_make_writable(struct pa_memchunk *c) {
+void pa_memchunk_make_writable(struct pa_memchunk *c, struct pa_memblock_stat *s) {
struct pa_memblock *n;
assert(c && c->memblock && c->memblock->ref >= 1);
if (c->memblock->ref == 1)
return;
- n = pa_memblock_new(c->length);
+ n = pa_memblock_new(c->length, s);
assert(n);
memcpy(n->data, c->memblock->data+c->index, c->length);
pa_memblock_unref(c->memblock);
@@ -52,9 +52,10 @@ struct pa_mcalign {
struct pa_memchunk chunk;
uint8_t *buffer;
size_t buffer_fill;
+ struct pa_memblock_stat *memblock_stat;
};
-struct pa_mcalign *pa_mcalign_new(size_t base) {
+struct pa_mcalign *pa_mcalign_new(size_t base, struct pa_memblock_stat *s) {
struct pa_mcalign *m;
assert(base);
@@ -64,6 +65,7 @@ struct pa_mcalign *pa_mcalign_new(size_t base) {
m->chunk.length = m->chunk.index = 0;
m->buffer = NULL;
m->buffer_fill = 0;
+ m->memblock_stat = s;
return m;
}
@@ -111,7 +113,7 @@ int pa_mcalign_pop(struct pa_mcalign *m, struct pa_memchunk *c) {
assert(m->buffer_fill <= m->base);
if (m->buffer_fill == m->base) {
- c->memblock = pa_memblock_new_dynamic(m->buffer, m->base);
+ c->memblock = pa_memblock_new_dynamic(m->buffer, m->base, m->memblock_stat);
assert(c->memblock);
c->index = 0;
c->length = m->base;