summaryrefslogtreecommitdiffstats
path: root/libdimension/texture.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:09 +0000
committerTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:09 +0000
commit8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021 (patch)
tree4092a281882e34ac53ec15d582dcbf2cb0d408c0 /libdimension/texture.c
parent1928016fe7aa439d4bfb61d3a7e7b7399ca7a229 (diff)
downloaddimension-8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021.tar.xz
Add destructor callbacks for polymorphic C types, and use their base
dmnsn_delete_*() function.
Diffstat (limited to 'libdimension/texture.c')
-rw-r--r--libdimension/texture.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libdimension/texture.c b/libdimension/texture.c
index 511c6b0..f232cbc 100644
--- a/libdimension/texture.c
+++ b/libdimension/texture.c
@@ -25,7 +25,11 @@
dmnsn_pigment *
dmnsn_new_pigment()
{
- return malloc(sizeof(dmnsn_pigment));
+ dmnsn_pigment *pigment = malloc(sizeof(dmnsn_pigment));
+ if (pigment) {
+ pigment->free_fn = NULL;
+ }
+ return pigment;
}
/* Free a dummy pigment */
@@ -39,7 +43,11 @@ dmnsn_delete_pigment(dmnsn_pigment *pigment)
dmnsn_texture *
dmnsn_new_texture()
{
- return malloc(sizeof(dmnsn_texture));
+ dmnsn_texture *texture = malloc(sizeof(dmnsn_texture));
+ if (texture) {
+ texture->pigment = NULL;
+ }
+ return texture;
}
/* Free a dummy texture */