diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-06-13 21:55:01 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-06-13 21:55:01 +0000 |
commit | 7bae1baa3e59bd87d3502c13297f2b67edaed764 (patch) | |
tree | b2e1806d28b06f160667b5879d48df5f27330956 /src | |
parent | e9c13e25b7c6a09ecf4fcd0f95a097e3242fbeb1 (diff) |
rearrange things
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2526 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src')
-rw-r--r-- | src/pulsecore/memchunk.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c index e6ad3bf8..5af85016 100644 --- a/src/pulsecore/memchunk.c +++ b/src/pulsecore/memchunk.c @@ -49,17 +49,20 @@ pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min) { pa_memblock_get_length(c->memblock) >= c->index+min) return c; - l = c->length; - if (l < min) - l = min; + l = PA_MAX(c->length, min); n = pa_memblock_new(pa_memblock_get_pool(c->memblock), l); - tdata = pa_memblock_acquire(n); + sdata = pa_memblock_acquire(c->memblock); + tdata = pa_memblock_acquire(n); + memcpy(tdata, (uint8_t*) sdata + c->index, c->length); - pa_memblock_release(n); + pa_memblock_release(c->memblock); + pa_memblock_release(n); + pa_memblock_unref(c->memblock); + c->memblock = n; c->index = 0; |