mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
memblock: Change pa_memblock_new_malloced to an inline function
To avoid the macro trap: I call pa_memblock_new_malloced with "pa_xmemdup" as data parameter, and that would expand to *two* calls to pa_xmemdup in case that remains a macro, which is clearly not intended. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
c36e191ce5
commit
d0e8b0fe07
1 changed files with 4 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ typedef struct pa_memblock pa_memblock;
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include <pulse/def.h>
|
#include <pulse/def.h>
|
||||||
|
#include <pulse/xmalloc.h>
|
||||||
#include <pulsecore/atomic.h>
|
#include <pulsecore/atomic.h>
|
||||||
#include <pulsecore/memchunk.h>
|
#include <pulsecore/memchunk.h>
|
||||||
|
|
||||||
|
|
@ -86,7 +87,9 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *, size_t length);
|
||||||
pa_memblock *pa_memblock_new_user(pa_mempool *, void *data, size_t length, pa_free_cb_t free_cb, void *free_cb_data, bool read_only);
|
pa_memblock *pa_memblock_new_user(pa_mempool *, void *data, size_t length, pa_free_cb_t free_cb, void *free_cb_data, bool read_only);
|
||||||
|
|
||||||
/* A special case of pa_memblock_new_user: take a memory buffer previously allocated with pa_xmalloc() */
|
/* A special case of pa_memblock_new_user: take a memory buffer previously allocated with pa_xmalloc() */
|
||||||
#define pa_memblock_new_malloced(p,data,length) pa_memblock_new_user(p, data, length, pa_xfree, data, 0)
|
static inline pa_memblock *pa_memblock_new_malloced(pa_mempool *p, void *data, size_t length) {
|
||||||
|
return pa_memblock_new_user(p, data, length, pa_xfree, data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate a new memory block of type PA_MEMBLOCK_FIXED */
|
/* Allocate a new memory block of type PA_MEMBLOCK_FIXED */
|
||||||
pa_memblock *pa_memblock_new_fixed(pa_mempool *, void *data, size_t length, bool read_only);
|
pa_memblock *pa_memblock_new_fixed(pa_mempool *, void *data, size_t length, bool read_only);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue