diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-26 00:46:40 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-04-26 12:58:55 +0200 |
commit | abc8019b64273b4f15dfe082a58b9f3f42823904 (patch) | |
tree | 6fcab1657e1e89caaa8faa2acd9cd6aa288faa96 | |
parent | dfc15f0ea42513f256e636ee78991e637b67be34 (diff) |
path-util: minor coding style fix
We usually avoid relying on C's degrade-to-boolean functionality when
comparing numerical variables with 0. We use it only for pointers and
actual booleans.
-rw-r--r-- | src/basic/path-util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 3998fc98a..7b38a01e3 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -417,7 +417,7 @@ int path_compare(const char *a, const char *b) { * Which one is sorted before the other does not really matter. * Here a relative path is ordered before an absolute path. */ d = (a[0] == '/') - (b[0] == '/'); - if (d) + if (d != 0) return d; for (;;) { @@ -440,12 +440,12 @@ int path_compare(const char *a, const char *b) { /* Alphabetical sort: "/foo/aaa" before "/foo/b" */ d = memcmp(a, b, MIN(j, k)); - if (d) + if (d != 0) return (d > 0) - (d < 0); /* sign of d */ /* Sort "/foo/a" before "/foo/aaa" */ d = (j > k) - (j < k); /* sign of (j - k) */ - if (d) + if (d != 0) return d; a += j; |