diff options
Diffstat (limited to 'libdimension/dimension/refcount.h')
-rw-r--r-- | libdimension/dimension/refcount.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h index f9f3286..9f6d8b0 100644 --- a/libdimension/dimension/refcount.h +++ b/libdimension/dimension/refcount.h @@ -23,10 +23,11 @@ * Generic reference count implementation. */ -/** - * Reference counter. - */ -typedef unsigned int dmnsn_refcount; +/** @internal The name of the reference count field in all structs. */ +#define DMNSN_REFCOUNT_NAME refcount + +/** @internal Declare a reference count field in a struct. */ +#define DMNSN_REFCOUNT unsigned int DMNSN_REFCOUNT_NAME /** * Increment a reference count. @@ -37,6 +38,6 @@ typedef unsigned int dmnsn_refcount; /* Suppress "address will always evaluate to true" warning */ \ void *testptr = (object); \ if (testptr) { \ - ++(object)->refcount; \ + ++(object)->DMNSN_REFCOUNT_NAME; \ } \ } while (0) |