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];
}

View file

@ -5,22 +5,6 @@
#include "macro.h"
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";
}
extern int saved_argc;
extern char **saved_argv;

View file

@ -5,8 +5,8 @@
#include "log.h"
#include "nspawn-patch-uid.h"
#include "user-util.h"
#include "string-util.h"
#include "tests.h"
#include "util.h"
int main(int argc, char *argv[]) {
uid_t shift, range;

View file

@ -5,6 +5,7 @@
#include "fdset.h"
#include "macro.h"
#include "string-util.h"
#include "time-util.h"
int serialize_item(FILE *f, const char *key, const char *value);

View file

@ -15,8 +15,8 @@
#include "macro.h"
#include "missing_prctl.h"
#include "parse-util.h"
#include "string-util.h"
#include "tests.h"
#include "util.h"
static uid_t test_uid = -1;
static gid_t test_gid = -1;