diff options
author | Andreas Schneider <asn@samba.org> | 2014-02-17 11:12:05 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-02-19 18:22:30 +0100 |
commit | 98ede411e3baeb4da8854450e002e4478c32ddd3 (patch) | |
tree | fae184a2ea7c2742a21e8f79df29ee57d56c3514 /source3 | |
parent | 2ccba45d301997042e9b3ba07bd157d02b7e7b94 (diff) | |
download | samba-98ede411e3baeb4da8854450e002e4478c32ddd3.tar.gz samba-98ede411e3baeb4da8854450e002e4478c32ddd3.tar.xz samba-98ede411e3baeb4da8854450e002e4478c32ddd3.zip |
s3-clitar: Improve readabilty of tar_path_in_list().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/client/clitar.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c index fa16c9b382c..3e380cb8654 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -1268,25 +1268,27 @@ static int tar_read_inclusion_file (struct tar *t, const char* filename) * If you want /path to be in the path list (path/a/, path/b/) set * @reverse to true to try to match the other way around. */ -static bool tar_path_in_list(struct tar *t, const char *path, bool reverse) +static bool tar_path_in_list(struct tar *t, const char *path, bool is_reverse) { int i; - const char *p = path; + const char *p; const char *pattern; - bool res; - if (!p || !p[0]) + if (path == NULL || path[0] == '\0') { return false; + } - p = skip_useless_char_in_path(p); + p = skip_useless_char_in_path(path); for (i = 0; i < t->path_list_size; i++) { + bool is_in_list; + pattern = skip_useless_char_in_path(t->path_list[i]); - res = is_subpath(p, pattern); - if (reverse) { - res = res || is_subpath(pattern, p); + is_in_list = is_subpath(p, pattern); + if (is_reverse) { + is_in_list = is_in_list || is_subpath(pattern, p); } - if (res) { + if (is_in_list) { return true; } } |