summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-09-01 21:44:00 +0200
committerLennart Poettering <lennart@poettering.net>2008-09-01 21:44:00 +0200
commit2c2b2717eb0e8d1831b498043e6995b477747e89 (patch)
treedbd3f1c43ef41e87dc1802e1becd1f76d69e567a
parent5467cc390d303028dc448a2f16df9d99b29f61a1 (diff)
use gcc malloc attribute macros for internal functions, too
-rw-r--r--src/pulse/xmalloc.c2
-rw-r--r--src/pulse/xmalloc.h12
2 files changed, 10 insertions, 4 deletions
diff --git a/src/pulse/xmalloc.c b/src/pulse/xmalloc.c
index 71a6847c..c570e40f 100644
--- a/src/pulse/xmalloc.c
+++ b/src/pulse/xmalloc.c
@@ -46,7 +46,7 @@
static void oom(void) PA_GCC_NORETURN;
-/** called in case of an OOM situation. Prints an error message and
+/* called in case of an OOM situation. Prints an error message and
* exits */
static void oom(void) {
static const char e[] = "Not enough memory\n";
diff --git a/src/pulse/xmalloc.h b/src/pulse/xmalloc.h
index 7a408d3d..b2643588 100644
--- a/src/pulse/xmalloc.h
+++ b/src/pulse/xmalloc.h
@@ -58,7 +58,9 @@ char *pa_xstrndup(const char *s, size_t l) PA_GCC_MALLOC;
void* pa_xmemdup(const void *p, size_t l) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE(2);
/** Internal helper for pa_xnew() */
-static inline void* _pa_xnew_internal(unsigned n, size_t k) {
+static void* _pa_xnew_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew_internal(size_t n, size_t k) {
assert(n < INT_MAX/k);
return pa_xmalloc(n*k);
}
@@ -67,7 +69,9 @@ static inline void* _pa_xnew_internal(unsigned n, size_t k) {
#define pa_xnew(type, n) ((type*) _pa_xnew_internal((n), sizeof(type)))
/** Internal helper for pa_xnew0() */
-static inline void* _pa_xnew0_internal(unsigned n, size_t k) {
+static void* _pa_xnew0_internal(size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(1,2);
+
+static inline void* _pa_xnew0_internal(size_t n, size_t k) {
assert(n < INT_MAX/k);
return pa_xmalloc0(n*k);
}
@@ -76,7 +80,9 @@ static inline void* _pa_xnew0_internal(unsigned n, size_t k) {
#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) {
+static void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) PA_GCC_MALLOC PA_GCC_ALLOC_SIZE2(2,3);
+
+static inline void* _pa_xnewdup_internal(const void *p, size_t n, size_t k) {
assert(n < INT_MAX/k);
return pa_xmemdup(p, n*k);
}