summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-26 00:46:40 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-26 01:24:39 +0100
commit373cd63a371cab08569a4c534f0b51a327243555 (patch)
tree7bdcb1fd09024f7089d8c5f414966ff2048bdb1f /src/basic
parent7cb48925dc9d6c74edcf800b447c6c0c6955687d (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.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/path-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 7b01633f5f..0b8cac8f3e 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -428,7 +428,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 (;;) {
@@ -451,12 +451,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;