summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-03-19 12:18:27 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-03-19 12:18:27 -0700
commit292357d284a6cb067a6cb3c7779225e65edb475e (patch)
tree7109afb3ab1ab1ce58a5f3fc275d75781b984aa0
parent35616ec3926638993caebdf617a7cbae725ef592 (diff)
til: add til_module_destroy_context() helper
-rw-r--r--src/til.c13
-rw-r--r--src/til.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/til.c b/src/til.c
index 2635c7a..b23df19 100644
--- a/src/til.c
+++ b/src/til.c
@@ -164,6 +164,19 @@ int til_module_create_context(const til_module_t *module, unsigned ticks, void *
}
+void * til_module_destroy_context(const til_module_t *module, void *context)
+{
+ assert(module);
+
+ if (!module->destroy_context)
+ return NULL;
+
+ module->destroy_context(context);
+
+ return NULL;
+}
+
+
/* select module if not yet selected, then setup the module. */
int til_module_setup(til_settings_t *settings, const til_setting_t **res_setting, const til_setting_desc_t **res_desc)
{
diff --git a/src/til.h b/src/til.h
index adf614d..bf6b25c 100644
--- a/src/til.h
+++ b/src/til.h
@@ -31,6 +31,7 @@ const til_module_t * til_lookup_module(const char *name);
void til_get_modules(const til_module_t ***res_modules, size_t *res_n_modules);
void til_module_render(const til_module_t *module, void *context, unsigned ticks, til_fb_fragment_t *fragment);
int til_module_create_context(const til_module_t *module, unsigned ticks, void **res_context);
+void * til_module_destroy_context(const til_module_t *module, void *context);
int til_module_setup(til_settings_t *settings, const til_setting_t **res_setting, const til_setting_desc_t **res_desc);
#endif
© All Rights Reserved