tree-wide: introduce empty_or_dash() helper

At quite a few places we check isempty() || streq(…, "-"), let's add a
helper to simplify that, and replace that by a single function call.
This commit is contained in:
Lennart Poettering
2019-04-08 12:03:33 +02:00
parent ea505047c5
commit e7b88b7bc1
9 changed files with 32 additions and 32 deletions
+6
View File
@@ -57,6 +57,12 @@ static inline const char *empty_to_dash(const char *str) {
return isempty(str) ? "-" : str;
}
static inline bool empty_or_dash(const char *str) {
return !str ||
str[0] == 0 ||
(str[0] == '-' && str[1] == 0);
}
static inline char *startswith(const char *s, const char *prefix) {
size_t l;