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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user