summaryrefslogtreecommitdiffstats
path: root/libdimension/checker.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/checker.c')
-rw-r--r--libdimension/checker.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libdimension/checker.c b/libdimension/checker.c
index 84b13bd..aa663ed 100644
--- a/libdimension/checker.c
+++ b/libdimension/checker.c
@@ -51,10 +51,15 @@ dmnsn_checker_pattern_fn(const dmnsn_pattern *checker, dmnsn_vector v)
return (n%2 == 0) ? 0.0 : 1.0;
}
+/** The singleton instance. */
+static dmnsn_pattern dmnsn_checker_instance = {
+ .pattern_fn = dmnsn_checker_pattern_fn,
+ .refcount = 1,
+};
+
dmnsn_pattern *
dmnsn_new_checker_pattern(void)
{
- dmnsn_pattern *checker = dmnsn_new_pattern();
- checker->pattern_fn = dmnsn_checker_pattern_fn;
- return checker;
+ DMNSN_INCREF(&dmnsn_checker_instance);
+ return &dmnsn_checker_instance;
}