diff options
author | Dmitri Pal <dpal@redhat.com> | 2012-12-23 15:14:08 -0500 |
---|---|---|
committer | Ondrej Kos <okos@redhat.com> | 2013-01-04 14:04:18 +0100 |
commit | e984e914b6aced5dabe250ad769c63186f21f8b8 (patch) | |
tree | 437bfd3657b02c033f9e9bafb654cb394bcb57a5 /path_utils | |
parent | 89243948c4f0499e70ca5bdbad62f03fd3cfb6a4 (diff) | |
download | ding-libs2-e984e914b6aced5dabe250ad769c63186f21f8b8.tar.gz ding-libs2-e984e914b6aced5dabe250ad769c63186f21f8b8.tar.xz ding-libs2-e984e914b6aced5dabe250ad769c63186f21f8b8.zip |
Make CLANG happy
Address CLANG issues in the main code.
Diffstat (limited to 'path_utils')
-rw-r--r-- | path_utils/path_utils.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/path_utils/path_utils.c b/path_utils/path_utils.c index 0a758c5..a9ae7b3 100644 --- a/path_utils/path_utils.c +++ b/path_utils/path_utils.c @@ -357,13 +357,13 @@ char **split_path(const char *path, int *count) for (start = end = path; *start; start = end) { for (start = end; *start && *start == '/'; start++); for (end = start; *end && *end != '/'; end++); - if ((component_len = end - start) == 0) break; + if ((end - start) == 0) break; *array_ptr++ = component_ptr; while (start < end) *component_ptr++ = *start++; *component_ptr++ = 0; } - *array_ptr++ = NULL; + *array_ptr = NULL; if (count) *count = n_components; return (char **)mem_block; } @@ -565,7 +565,7 @@ int directory_list(const char *path, bool recursive, } for (entry = readdir(dir); entry; entry = readdir(dir)) { - prune = false; + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) { continue; @@ -611,25 +611,21 @@ bool is_ancestor_path(const char *ancestor, const char *path) { char **path_components, **ancestor_components; int i, path_count, ancestor_count; - bool result; + bool result = false; - result = false; path_components = split_path(path, &path_count); ancestor_components = split_path(ancestor, &ancestor_count); if (!path_components || !ancestor_components) { - result = false; goto exit; } if (ancestor_count >= path_count) { - result = false; goto exit; } for (i = 0; i < ancestor_count; i++) { if (strcmp(path_components[i], ancestor_components[i]) != 0) { - result = false; goto exit; } } |