From 9e52f33d916258f54ea514a3d335a6cc034ce99a Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Mon, 25 Jun 2012 05:33:24 +0000 Subject: [PATCH] Implement MEMLOCK and UNLOCK as functions Converting these macros to functions declared static inline allow the C type-checker to work and avoid warnings about unused expression values. These warnings break the build with clang. --- libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c index cc0b9603f5..0369e08b5c 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c @@ -209,9 +209,14 @@ void (*_su_home_destroy_mutexes)(void *mutex); su_inline void safefree(void *b) { b ? free(b) : (void)0; } #endif -#define MEMLOCK(h) \ - ((void)((h) && (h)->suh_lock ? _su_home_locker((h)->suh_lock) : 0), (h)->suh_blocks) -#define UNLOCK(h) ((void)((h) && (h)->suh_lock ? _su_home_unlocker((h)->suh_lock) : 0), NULL) +static inline su_block_t* MEMLOCK(const su_home_t *h) { + if (h && h->suh_lock) _su_home_locker(h->suh_lock); + return h->suh_blocks; +} +static inline void* UNLOCK(const su_home_t *h) { + if (h && h->suh_lock) _su_home_unlocker(h->suh_lock); + return NULL; +} #ifdef NDEBUG #define MEMCHECK 0