diff options
Diffstat (limited to 'libdimension/dimension/refcount.h')
-rw-r--r-- | libdimension/dimension/refcount.h | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h index 9d2c304..4431cbc 100644 --- a/libdimension/dimension/refcount.h +++ b/libdimension/dimension/refcount.h @@ -24,35 +24,20 @@ */ /** - * Increment a reference count. - * @param[in,out] object The reference-counted object to acquire. - */ -#define DMNSN_INCREF(obj) ((void)++(*(obj)->refcount)) - -/** - * @internal - * Decrement a reference count. - * @param[in,out] object The reference-counted object to release. - * @return Whether the object is now garbage. - */ -#define DMNSN_DECREF(obj) (*(obj)->refcount == 0 || --(*(obj)->refcount) == 0) - -/** * Reference counter. */ typedef unsigned int dmnsn_refcount; /** - * @internal - * Create a reference count. - * @return A new reference counter, initialized to zero (a "borrowed" reference, - * which will be garbage-collected the first time it is deleted). + * Increment a reference count. + * @param[in,out] object The reference-counted object to acquire. */ -dmnsn_refcount *dmnsn_new_refcount(void); +#define DMNSN_INCREF(obj) ((void)++(obj)->refcount) /** * @internal - * Delete a reference count. Raises an error if the reference count wasn't - * zero. + * Decrement a reference count. + * @param[in,out] object The reference-counted object to release. + * @return Whether the object is now garbage. */ -void dmnsn_delete_refcount(dmnsn_refcount *refcount); +#define DMNSN_DECREF(obj) ((obj)->refcount == 0 || --(obj)->refcount == 0) |