diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-06-11 12:08:37 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-06-11 12:08:37 +0000 |
commit | 00da37f2c448096cdd54481b072db47b2f253141 (patch) | |
tree | cb6c51231fa498831b3e63660105ec00ea98d8f5 /src/pulse/xmalloc.h | |
parent | 6aeec56708f4af2da0b83fdd65a0d153b9bed272 (diff) |
Merge HUGE set of changes temporarily into a branch, to allow me to move them from one machine to another (lock-free and stuff)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1469 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulse/xmalloc.h')
-rw-r--r-- | src/pulse/xmalloc.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pulse/xmalloc.h b/src/pulse/xmalloc.h index 2f6399c5..62a450dc 100644 --- a/src/pulse/xmalloc.h +++ b/src/pulse/xmalloc.h @@ -75,6 +75,15 @@ static inline void* pa_xnew0_internal(unsigned n, size_t k) { /** Same as pa_xnew() but set the memory to zero */ #define pa_xnew0(type, n) ((type*) pa_xnew0_internal((n), sizeof(type))) +/** Internal helper for pa_xnew0() */ +static inline void* pa_xnewdup_internal(const void *p, unsigned n, size_t k) { + assert(n < INT_MAX/k); + return pa_xmemdup(p, n*k); +} + +/** Same as pa_xnew() but set the memory to zero */ +#define pa_xnewdup(type, p, n) ((type*) pa_xnewdup_internal((p), (n), sizeof(type))) + PA_C_DECL_END #endif |