From 07441cc2e624ff5d0b81fba102fee648110e16a4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 10 Aug 2022 18:33:27 -0400 Subject: Factor jalv_init_env() out of jalv_open() --- src/jalv.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/jalv.c b/src/jalv.c index b5d63e9..5c61004 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -966,6 +966,17 @@ jalv_init_nodes(LilvWorld* const world, JalvNodes* const nodes) #undef MAP_NODE } +static void +jalv_init_env(SerdEnv* const env) +{ + serd_env_set_prefix_from_strings( + env, (const uint8_t*)"patch", (const uint8_t*)LV2_PATCH_PREFIX); + serd_env_set_prefix_from_strings( + env, (const uint8_t*)"time", (const uint8_t*)LV2_TIME_PREFIX); + serd_env_set_prefix_from_strings( + env, (const uint8_t*)"xsd", (const uint8_t*)NS_XSD); +} + int jalv_open(Jalv* const jalv, int* argc, char*** argv) { @@ -986,6 +997,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) return ret; } + jalv->env = serd_env_new(NULL); jalv->symap = symap_new(); jalv_init_urids(jalv->symap, &jalv->urids); @@ -1007,14 +1019,7 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) init_feature(&jalv->features.unmap_feature, LV2_URID__unmap, &jalv->unmap); lv2_atom_forge_init(&jalv->forge, &jalv->map); - - jalv->env = serd_env_new(NULL); - serd_env_set_prefix_from_strings( - jalv->env, (const uint8_t*)"patch", (const uint8_t*)LV2_PATCH_PREFIX); - serd_env_set_prefix_from_strings( - jalv->env, (const uint8_t*)"time", (const uint8_t*)LV2_TIME_PREFIX); - serd_env_set_prefix_from_strings( - jalv->env, (const uint8_t*)"xsd", (const uint8_t*)NS_XSD); + jalv_init_env(jalv->env); jalv->sratom = sratom_new(&jalv->map); jalv->ui_sratom = sratom_new(&jalv->map); -- cgit v1.2.1