mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
add new pa_memchunk_will_need() API, similar to pa_memblock_will_need()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1747 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
f36ca79716
commit
7dbabc47bb
2 changed files with 22 additions and 0 deletions
|
|
@ -29,8 +29,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulsecore/macro.h>
|
||||
#include <pulsecore/core-util.h>
|
||||
|
||||
#include "memchunk.h"
|
||||
|
||||
|
|
@ -72,3 +75,19 @@ pa_memchunk* pa_memchunk_reset(pa_memchunk *c) {
|
|||
|
||||
return c;
|
||||
}
|
||||
|
||||
pa_memchunk *pa_memchunk_will_need(pa_memchunk *c) {
|
||||
void *p;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(c->memblock);
|
||||
|
||||
/* A version of pa_memblock_will_need() that works on memchunks
|
||||
* instead of memblocks */
|
||||
|
||||
p = (uint8_t*) pa_memblock_acquire(c->memblock) + c->index;
|
||||
pa_will_need(p, c->length);
|
||||
pa_memblock_release(c->memblock);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,4 +44,7 @@ pa_memchunk* pa_memchunk_make_writable(pa_memchunk *c, size_t min);
|
|||
* but sets all members to zero. */
|
||||
pa_memchunk* pa_memchunk_reset(pa_memchunk *c);
|
||||
|
||||
/* Map a memory chunk back into memory if it was swapped out */
|
||||
pa_memchunk *pa_memchunk_will_need(pa_memchunk *c);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue