diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-06-12 02:37:51 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-06-13 00:16:06 -0600 |
commit | 7acd8ea6673b7a90ed4041408ccf1b024b8a007a (patch) | |
tree | d52199dd7c58e0217bfd1a74e7601d739ad333f5 /libdimension/pattern.c | |
parent | 066261810c2fca192677c5c1c01c91d6ecec65a0 (diff) | |
download | dimension-7acd8ea6673b7a90ed4041408ccf1b024b8a007a.tar.xz |
Vast libdimension API and internals improvements.
Couldn't really do these while I was trying to be POV-Ray compatible,
'cause they would've broken compatibility.
Diffstat (limited to 'libdimension/pattern.c')
-rw-r--r-- | libdimension/pattern.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libdimension/pattern.c b/libdimension/pattern.c index b266527..368755a 100644 --- a/libdimension/pattern.c +++ b/libdimension/pattern.c @@ -30,8 +30,9 @@ dmnsn_pattern * dmnsn_new_pattern(void) { dmnsn_pattern *pattern = dmnsn_malloc(sizeof(dmnsn_pattern)); - pattern->trans = dmnsn_identity_matrix(); - pattern->free_fn = NULL; + pattern->trans = dmnsn_identity_matrix(); + pattern->free_fn = NULL; + pattern->refcount = 1; return pattern; } @@ -39,10 +40,12 @@ dmnsn_new_pattern(void) void dmnsn_delete_pattern(dmnsn_pattern *pattern) { - if (pattern->free_fn) { - pattern->free_fn(pattern->ptr); + if (DMNSN_DECREF(pattern)) { + if (pattern->free_fn) { + pattern->free_fn(pattern->ptr); + } + dmnsn_free(pattern); } - dmnsn_free(pattern); } /* Precompute the transformation matrix inverse */ |