From d9feb39a41cf3d0dfc4c797f1a7aee99d8609c16 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Nov 2022 17:54:34 -0500 Subject: Use zix_path_parent_path() --- src/state.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index 8442949..63b26e6 100644 --- a/src/state.c +++ b/src/state.c @@ -752,14 +752,15 @@ lilv_state_new_from_file(LilvWorld* world, (subject) ? subject->node : sord_node_from_serd_node(world->world, env, &node, NULL, NULL); - char* dirname = lilv_path_parent(path); - char* real_path = zix_canonical_path(NULL, dirname); - char* dir_path = zix_path_join(NULL, real_path, NULL); - LilvState* state = + const ZixStringView dirname = zix_path_parent_path(path); + char* const real_path = zix_canonical_path(NULL, dirname.data); + char* const dir_path = zix_path_join(NULL, real_path, NULL); + + LilvState* const state = new_state_from_model(world, map, model, subject_node, dir_path); + zix_free(NULL, dir_path); zix_free(NULL, real_path); - free(dirname); serd_node_free(&node); zix_free(NULL, abs_path); -- cgit v1.2.1