util_path: Get rid of "? true : false"

The functions use the C99 _Bool type in form of the alias bool from
stdbool.h as return type. Scalars are implicitly converted to _Bool.
Values equal to zero to 0 (false). Nonzero values to 1 (true).
Therefore the explicit conversion using the ternary operator ?: with
true and false is not required.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jens Remus
2019-04-08 13:05:47 +02:00
committed by Jan Höppner
parent b0007fea98
commit d37dc68693

View File

@@ -107,7 +107,7 @@ bool util_path_is_readable(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, R_OK) == 0 ? true : false;
rc = access(path, R_OK) == 0;
free(path);
return rc;
@@ -131,7 +131,7 @@ bool util_path_is_writable(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, W_OK) == 0 ? true : false;
rc = access(path, W_OK) == 0;
free(path);
return rc;
@@ -157,7 +157,7 @@ bool util_path_is_reg_file(const char *fmt, ...)
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb) == 0)
rc = S_ISREG(sb.st_mode) ? true : false;
rc = S_ISREG(sb.st_mode);
free(path);
return rc;
}
@@ -182,7 +182,7 @@ bool util_path_is_dir(const char *fmt, ...)
UTIL_VASPRINTF(&path, fmt, ap);
if (stat(path, &sb) == 0)
rc = S_ISDIR(sb.st_mode) ? true : false;
rc = S_ISDIR(sb.st_mode);
free(path);
return rc;
}
@@ -205,7 +205,7 @@ bool util_path_exists(const char *fmt, ...)
bool rc;
UTIL_VASPRINTF(&path, fmt, ap);
rc = access(path, F_OK) == 0 ? true : false;
rc = access(path, F_OK) == 0;
free(path);
return rc;
}