diff options
author | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-08-31 18:23:15 +0300 |
---|---|---|
committer | Jocelyn Turcotte <jturcotte@woboq.com> | 2015-08-31 18:23:25 +0300 |
commit | 35318ea9b51d6447158527f99e6a4fcbd23d5366 (patch) | |
tree | 186587f747b423d6db1e4e5ff836a6e31650a28f /csync | |
parent | 7aeb27d5ee6a54716cf43cf0eddecb6252b4de27 (diff) |
Fix the Windows build
Use an iterator variable declared outside of the loop condition
expression.
MinGW doesn't support C99 very easily and it's easier to keep
our C code C89 compliant.
Diffstat (limited to 'csync')
-rw-r--r-- | csync/src/csync_exclude.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/csync/src/csync_exclude.c b/csync/src/csync_exclude.c index d5cee4368..c673affb9 100644 --- a/csync/src/csync_exclude.c +++ b/csync/src/csync_exclude.c @@ -268,23 +268,23 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch c_strlist_t *path_components = c_strlist_new(32); char *path_split = strdup(path); size_t len = strlen(path_split); - for (int j = len; ; --j) { + for (i = len; ; --i) { // read backwards until a path separator is found - if (j != 0 && path_split[j-1] != '/') { + if (i != 0 && path_split[i-1] != '/') { continue; } // check 'basename', i.e. for "/foo/bar/fi" we'd check 'fi', 'bar', 'foo' - if (path_split[j] != 0) { - c_strlist_add_grow(&path_components, path_split + j); + if (path_split[i] != 0) { + c_strlist_add_grow(&path_components, path_split + i); } - if (j == 0 || !check_leading_dirs) { + if (i == 0 || !check_leading_dirs) { break; } // check 'dirname', i.e. for "/foo/bar/fi" we'd check '/foo/bar', '/foo' - path_split[j-1] = '\0'; + path_split[i-1] = '\0'; c_strlist_add_grow(&path_components, path_split); } SAFE_FREE(path_split); |