summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/camera.h2
-rw-r--r--libdimension/dimension/canvas.h2
-rw-r--r--libdimension/dimension/interior.h2
-rw-r--r--libdimension/dimension/object.h2
-rw-r--r--libdimension/dimension/refcount.h29
-rw-r--r--libdimension/dimension/texture.h4
6 files changed, 13 insertions, 28 deletions
diff --git a/libdimension/dimension/camera.h b/libdimension/dimension/camera.h
index 67fffc0..75d86a9 100644
--- a/libdimension/dimension/camera.h
+++ b/libdimension/dimension/camera.h
@@ -46,7 +46,7 @@ struct dmnsn_camera {
void *ptr; /**< @internal Generic pointer for camera info. */
- dmnsn_refcount *refcount; /**< @internal reference count. */
+ dmnsn_refcount refcount; /**< @internal reference count. */
};
/**
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h
index f33fc88..864e2d6 100644
--- a/libdimension/dimension/canvas.h
+++ b/libdimension/dimension/canvas.h
@@ -40,7 +40,7 @@ typedef struct {
*/
dmnsn_color *pixels;
- dmnsn_refcount *refcount; /**< @internal Reference count. */
+ dmnsn_refcount refcount; /**< @internal Reference count. */
} dmnsn_canvas;
/* Forward-declare dmnsn_canvas_optimizer */
diff --git a/libdimension/dimension/interior.h b/libdimension/dimension/interior.h
index 76f0a32..22a9091 100644
--- a/libdimension/dimension/interior.h
+++ b/libdimension/dimension/interior.h
@@ -33,7 +33,7 @@ typedef struct dmnsn_interior {
void *ptr;
/** @internal Reference count. */
- dmnsn_refcount *refcount;
+ dmnsn_refcount refcount;
} dmnsn_interior;
/**
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index efe2323..02daaba 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -92,7 +92,7 @@ struct dmnsn_object {
void *ptr;
/** @internal Reference count. */
- dmnsn_refcount *refcount;
+ dmnsn_refcount refcount;
};
/**
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)
diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h
index 8051c02..7edcabc 100644
--- a/libdimension/dimension/texture.h
+++ b/libdimension/dimension/texture.h
@@ -31,8 +31,8 @@ typedef struct {
dmnsn_matrix trans; /**< Transformation matrix. */
dmnsn_matrix trans_inv; /**< The inverse of the transformation matrix. */
- dmnsn_refcount *refcount; /**< @internal Reference count. */
- bool should_init; /**< @internal Whether to initialize the texture. */
+ dmnsn_refcount refcount; /**< @internal Reference count. */
+ bool should_init; /**< @internal Whether to initialize the texture. */
} dmnsn_texture;
/**