X Tutup
Skip to content

Commit 55fced5

Browse files
committed
util-lib: move yes_no() and friends to string-util.h
1 parent d4d99bc commit 55fced5

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

src/basic/string-util.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@ static inline const char *strna(const char *s) {
4545
return s ?: "n/a";
4646
}
4747

48+
static inline const char* yes_no(bool b) {
49+
return b ? "yes" : "no";
50+
}
51+
52+
static inline const char* true_false(bool b) {
53+
return b ? "true" : "false";
54+
}
55+
56+
static inline const char* one_zero(bool b) {
57+
return b ? "1" : "0";
58+
}
59+
60+
static inline const char* enable_disable(bool b) {
61+
return b ? "enable" : "disable";
62+
}
63+
4864
static inline bool isempty(const char *p) {
4965
return !p || !p[0];
5066
}

src/basic/util.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,6 @@
55

66
#include "macro.h"
77

8-
static inline const char* yes_no(bool b) {
9-
return b ? "yes" : "no";
10-
}
11-
12-
static inline const char* true_false(bool b) {
13-
return b ? "true" : "false";
14-
}
15-
16-
static inline const char* one_zero(bool b) {
17-
return b ? "1" : "0";
18-
}
19-
20-
static inline const char* enable_disable(bool b) {
21-
return b ? "enable" : "disable";
22-
}
23-
248
extern int saved_argc;
259
extern char **saved_argv;
2610

src/nspawn/test-patch-uid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include "log.h"
66
#include "nspawn-patch-uid.h"
77
#include "user-util.h"
8+
#include "string-util.h"
89
#include "tests.h"
9-
#include "util.h"
1010

1111
int main(int argc, char *argv[]) {
1212
uid_t shift, range;

src/shared/serialize.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "fdset.h"
77
#include "macro.h"
8+
#include "string-util.h"
89
#include "time-util.h"
910

1011
int serialize_item(FILE *f, const char *key, const char *value);

src/test/test-capability.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include "macro.h"
1616
#include "missing_prctl.h"
1717
#include "parse-util.h"
18+
#include "string-util.h"
1819
#include "tests.h"
19-
#include "util.h"
2020

2121
static uid_t test_uid = -1;
2222
static gid_t test_gid = -1;

0 commit comments

Comments
 (0)
X Tutup