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.
This commit is contained in:
parent
c01a142665
commit
9e52f33d91
|
@ -209,9 +209,14 @@ void (*_su_home_destroy_mutexes)(void *mutex);
|
||||||
su_inline void safefree(void *b) { b ? free(b) : (void)0; }
|
su_inline void safefree(void *b) { b ? free(b) : (void)0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MEMLOCK(h) \
|
static inline su_block_t* MEMLOCK(const su_home_t *h) {
|
||||||
((void)((h) && (h)->suh_lock ? _su_home_locker((h)->suh_lock) : 0), (h)->suh_blocks)
|
if (h && h->suh_lock) _su_home_locker(h->suh_lock);
|
||||||
#define UNLOCK(h) ((void)((h) && (h)->suh_lock ? _su_home_unlocker((h)->suh_lock) : 0), NULL)
|
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
|
#ifdef NDEBUG
|
||||||
#define MEMCHECK 0
|
#define MEMCHECK 0
|
||||||
|
|
Loading…
Reference in New Issue