util-lib: move yes_no() and friends to string-util.h

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-08-01 13:10:49 +02:00
parent d4d99bc6e4
commit 55fced5a19
5 changed files with 19 additions and 18 deletions

View File

@@ -45,6 +45,22 @@ static inline const char *strna(const char *s) {
return s ?: "n/a";
}
static inline const char* yes_no(bool b) {
return b ? "yes" : "no";
}
static inline const char* true_false(bool b) {
return b ? "true" : "false";
}
static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
static inline const char* enable_disable(bool b) {
return b ? "enable" : "disable";
}
static inline bool isempty(const char *p) {
return !p || !p[0];
}