diff options
author | David Robillard <d@drobilla.net> | 2022-11-12 17:54:34 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-16 10:22:55 -0500 |
commit | d9feb39a41cf3d0dfc4c797f1a7aee99d8609c16 (patch) | |
tree | 86a9f1bdd51c8b5fd5e8e27506ef167a179b6fb5 /src/util.c | |
parent | de60d222d9b1ff7931b74ded75cd8e31d77d9bd9 (diff) | |
download | lilv-d9feb39a41cf3d0dfc4c797f1a7aee99d8609c16.tar.gz lilv-d9feb39a41cf3d0dfc4c797f1a7aee99d8609c16.tar.bz2 lilv-d9feb39a41cf3d0dfc4c797f1a7aee99d8609c16.zip |
Use zix_path_parent_path()
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,7 +1,6 @@ // Copyright 2007-2019 David Robillard <d@drobilla.net> // SPDX-License-Identifier: ISC -#include "filesystem.h" #include "lilv_internal.h" #include "lilv/lilv.h" @@ -9,6 +8,7 @@ #include "zix/allocator.h" #include "zix/filesystem.h" #include "zix/path.h" +#include "zix/string_view.h" #include <sys/stat.h> @@ -262,8 +262,9 @@ update_latest(const char* path, const char* name, void* data) char* lilv_get_latest_copy(const char* path, const char* copy_path) { - char* copy_dir = lilv_path_parent(copy_path); - Latest latest = {lilv_strjoin(copy_path, ".%u", NULL), 0, NULL}; + char* copy_dir = zix_string_view_copy(NULL, zix_path_parent_path(copy_path)); + + Latest latest = {lilv_strjoin(copy_path, ".%u", NULL), 0, NULL}; struct stat st; if (!stat(path, &st)) { @@ -275,6 +276,6 @@ lilv_get_latest_copy(const char* path, const char* copy_path) zix_dir_for_each(copy_dir, &latest, update_latest); free(latest.pattern); - free(copy_dir); + zix_free(NULL, copy_dir); return latest.latest; } |