summaryrefslogtreecommitdiffstats
path: root/src/filesystem.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-22 19:20:02 -0400
committerDavid Robillard <d@drobilla.net>2024-06-22 19:32:12 -0400
commitd8204ca7482a9a5184cdd99f16f9d47b0cbe1c22 (patch)
tree23b6181ea78d46bf618d58675b8bc86cce537c58 /src/filesystem.c
parent5f1c4d8ae807a33ceef342702bfff9a12ee6e251 (diff)
downloadzix-d8204ca7482a9a5184cdd99f16f9d47b0cbe1c22.tar.gz
zix-d8204ca7482a9a5184cdd99f16f9d47b0cbe1c22.tar.bz2
zix-d8204ca7482a9a5184cdd99f16f9d47b0cbe1c22.zip
Avoid cppcheck warning about self-assignment
Diffstat (limited to 'src/filesystem.c')
-rw-r--r--src/filesystem.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/filesystem.c b/src/filesystem.c
index 95005ae..61487e9 100644
--- a/src/filesystem.c
+++ b/src/filesystem.c
@@ -49,17 +49,18 @@ zix_create_directories(ZixAllocator* const allocator,
// Create each directory down the path
while (p.state != ZIX_PATH_END) {
- const char old_end = path[p.range.end];
+ char* const end = &path[p.range.end];
+ const char old_last = *end;
- path[p.range.end] = '\0';
+ *end = '\0';
if (zix_file_type(path) != ZIX_FILE_TYPE_DIRECTORY) {
if ((st = zix_create_directory(path))) {
break;
}
}
- path[p.range.end] = old_end;
- p = zix_path_next(path, p);
+ *end = old_last;
+ p = zix_path_next(path, p);
}
zix_free(allocator, path);