From f09537ca61cdef6920ff3aeacba75521670a9acd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 17 Nov 2024 15:49:09 -0500 Subject: Factor out jalv_free_nodes() --- src/jalv.c | 4 +--- src/nodes.c | 8 ++++++++ src/nodes.h | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/jalv.c b/src/jalv.c index 8906d23..4f9d4f6 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -1212,9 +1212,7 @@ jalv_close(Jalv* const jalv) zix_free(NULL, jalv->ui_msg); zix_free(NULL, jalv->audio_msg); free(jalv->controls_buf); - for (LilvNode** n = (LilvNode**)&jalv->nodes; *n; ++n) { - lilv_node_free(*n); - } + jalv_free_nodes(&jalv->nodes); #if USE_SUIL suil_host_free(jalv->ui_host); #endif diff --git a/src/nodes.c b/src/nodes.c index 8d6e409..32ffa71 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -66,3 +66,11 @@ jalv_init_nodes(LilvWorld* const world, JalvNodes* const nodes) #undef MAP_NODE } + +void +jalv_free_nodes(JalvNodes* const nodes) +{ + for (LilvNode** n = (LilvNode**)nodes; *n; ++n) { + lilv_node_free(*n); + } +} diff --git a/src/nodes.h b/src/nodes.h index 61deedc..60ffe36 100644 --- a/src/nodes.h +++ b/src/nodes.h @@ -58,6 +58,9 @@ typedef struct { void jalv_init_nodes(LilvWorld* world, JalvNodes* nodes); +void +jalv_free_nodes(JalvNodes* nodes); + JALV_END_DECLS #endif // JALV_NODES_H -- cgit v1.2.1