diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-07-28 21:34:45 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-07-28 21:34:45 -0600 |
commit | 250c28ccdef5f238677b34f21ec7fab06588a127 (patch) | |
tree | 7aa115cf5d7c4119bedafc31703cd4a0a11d9d64 /libdimension/dimension/refcount.h | |
parent | 275c2542c4e414ffe01558cfca2445dcad6bbd29 (diff) | |
download | dimension-250c28ccdef5f238677b34f21ec7fab06588a127.tar.xz |
Make the checker pattern a singleton.
Diffstat (limited to 'libdimension/dimension/refcount.h')
-rw-r--r-- | libdimension/dimension/refcount.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h index 5ffde4c..a0f5b6e 100644 --- a/libdimension/dimension/refcount.h +++ b/libdimension/dimension/refcount.h @@ -32,7 +32,14 @@ typedef unsigned int dmnsn_refcount; * Increment a reference count. * @param[in,out] object The reference-counted object to acquire. */ -#define DMNSN_INCREF(object) ((void)((object) && ++(object)->refcount)) +#define DMNSN_INCREF(object) \ + do { \ + /* Suppress "address will always evaluate to true" warning */ \ + void *testptr = (object); \ + if (testptr) { \ + ++(object)->refcount; \ + } \ + } while (0) /** * @internal |