summaryrefslogtreecommitdiffstats
path: root/libdimension/pattern.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-30 19:03:33 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-30 19:03:33 -0400
commit8807ab192b36acbc94e11790e9261c799ce77892 (patch)
tree7b37684cb5679c132d21f3bd8c2ff47a11e3df55 /libdimension/pattern.c
parent4781d3a2a7ec463ee712c8de6362d8b6c872c31b (diff)
downloaddimension-8807ab192b36acbc94e11790e9261c799ce77892.tar.xz
pattern: Use pool.
Diffstat (limited to 'libdimension/pattern.c')
-rw-r--r--libdimension/pattern.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/libdimension/pattern.c b/libdimension/pattern.c
index 56c7c48..22f5c13 100644
--- a/libdimension/pattern.c
+++ b/libdimension/pattern.c
@@ -25,39 +25,19 @@
#include "dimension-internal.h"
-static void
-dmnsn_default_pattern_free_fn(dmnsn_pattern *pattern)
-{
- dmnsn_free(pattern);
-}
-
-/* Allocate a dummy pattern */
dmnsn_pattern *
-dmnsn_new_pattern(void)
+dmnsn_new_pattern(dmnsn_pool *pool)
{
- dmnsn_pattern *pattern = DMNSN_MALLOC(dmnsn_pattern);
+ dmnsn_pattern *pattern = DMNSN_PALLOC(pool, dmnsn_pattern);
dmnsn_init_pattern(pattern);
return pattern;
}
-/* Initialize a pattern */
void
dmnsn_init_pattern(dmnsn_pattern *pattern)
{
- pattern->free_fn = dmnsn_default_pattern_free_fn;
- DMNSN_REFCOUNT_INIT(pattern);
-}
-
-/* Delete a pattern */
-void
-dmnsn_delete_pattern(dmnsn_pattern *pattern)
-{
- if (DMNSN_DECREF(pattern)) {
- pattern->free_fn(pattern);
- }
}
-/* Invoke the pattern callback with the right transformation */
double
dmnsn_pattern_value(const dmnsn_pattern *pattern, dmnsn_vector v)
{