diff options
author | David Robillard <d@drobilla.net> | 2023-05-10 16:00:29 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-10 18:27:55 -0400 |
commit | 67526c25f4a751be27d2f9eed38d07fe52342aa5 (patch) | |
tree | 69039501fb0c15d6386d2fe73174af47085f673f /src | |
parent | ff5104de74122477459b48df8b046d06d2db506b (diff) | |
download | zix-67526c25f4a751be27d2f9eed38d07fe52342aa5.tar.gz zix-67526c25f4a751be27d2f9eed38d07fe52342aa5.tar.bz2 zix-67526c25f4a751be27d2f9eed38d07fe52342aa5.zip |
Add ZIX_STATIC_STRING()
Diffstat (limited to 'src')
-rw-r--r-- | src/path.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -496,6 +496,8 @@ zix_path_lexically_relative(ZixAllocator* const allocator, const char* const path, const char* const base) { + static const ZixStringView dot = ZIX_STATIC_STRING("."); + // Mismatched roots can't be expressed in relative form const ZixRootSlices path_root = zix_path_root_slices(path); const ZixRootSlices base_root = zix_path_root_slices(base); @@ -520,7 +522,7 @@ zix_path_lexically_relative(ZixAllocator* const allocator, // Matching paths reduce to "." if ((a.state == ZIX_PATH_END && b.state == ZIX_PATH_END) || (zix_is_empty_range(a.range) && b.state == ZIX_PATH_END)) { - return zix_string_view_copy(allocator, zix_string(".")); + return zix_string_view_copy(allocator, dot); } // Count the trailing non-matching entries in base @@ -546,7 +548,7 @@ zix_path_lexically_relative(ZixAllocator* const allocator, // A result with no up-references or names reduces to "." if (n_up == 0 && a.state == ZIX_PATH_END) { - return zix_string_view_copy(allocator, zix_string(".")); + return zix_string_view_copy(allocator, dot); } // Allocate buffer for relative path result |