diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-03-19 12:24:43 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-03-19 12:24:43 -0700 |
commit | f08356c4d204b07847a1d550b2acda44a897f970 (patch) | |
tree | 8b3e7c46de3f45d07d8427d9145978d651d9aa26 /src | |
parent | 292357d284a6cb067a6cb3c7779225e65edb475e (diff) |
*: use til_module_destroy_context()
Mechanically replaced ad-hoc til_module_t.destroy_context()
invocations with helper calls.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/modules/compose/compose.c | 6 | ||||
-rw-r--r-- | src/modules/montage/montage.c | 10 | ||||
-rw-r--r-- | src/modules/rtv/rtv.c | 4 |
4 files changed, 6 insertions, 19 deletions
@@ -282,10 +282,7 @@ int main(int argc, const char *argv[]) pthread_cancel(rototiller.thread); pthread_join(rototiller.thread, NULL); til_shutdown(); - - if (rototiller.module_context) - rototiller.module->destroy_context(rototiller.module_context); - + til_module_destroy_context(rototiller.module, rototiller.module_context); til_fb_free(rototiller.fb); return EXIT_SUCCESS; diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c index cd15fa1..3e5334b 100644 --- a/src/modules/compose/compose.c +++ b/src/modules/compose/compose.c @@ -92,10 +92,8 @@ static void compose_destroy_context(void *context) { compose_context_t *ctxt = context; - for (int i = 0; i < ctxt->n_layers; i++) { - if (ctxt->layers[i].module_ctxt) - ctxt->layers[i].module->destroy_context(ctxt->layers[i].module_ctxt); - } + for (int i = 0; i < ctxt->n_layers; i++) + til_module_destroy_context(ctxt->layers[i].module, ctxt->layers[i].module_ctxt); free(context); } diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 2af0457..5782782 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -101,14 +101,8 @@ static void montage_destroy_context(void *context) { montage_context_t *ctxt = context; - for (int i = 0; i < ctxt->n_modules; i++) { - const til_module_t *module = ctxt->modules[i]; - - if (!ctxt->contexts[i]) - continue; - - module->destroy_context(ctxt->contexts[i]); - } + for (int i = 0; i < ctxt->n_modules; i++) + til_module_destroy_context(ctxt->modules[i], ctxt->contexts[i]); free(ctxt->contexts); free(ctxt->modules); diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index bd48eb3..47905ec 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -145,9 +145,7 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) if (ctxt->channel->cumulative_time >= rtv_context_duration) { ctxt->channel->cumulative_time = 0; - if (ctxt->channel->module->destroy_context) - ctxt->channel->module->destroy_context(ctxt->channel->module_ctxt); - ctxt->channel->module_ctxt = NULL; + ctxt->channel->module_ctxt = til_module_destroy_context(ctxt->channel->module, ctxt->channel->module_ctxt); free(ctxt->channel->settings); ctxt->channel->settings = NULL; |