diff options
| author | Michael Biebl <biebl@debian.org> | 2019-12-18 18:30:31 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-12-18 18:30:31 +0100 |
| commit | 4bde769dba8f804547ce1f5fcda731035d3d45f1 (patch) | |
| tree | 3a4907fdbf4972fad5a036ef64ce643d704e8733 /shared/systemd/src/basic/string-util.h | |
| parent | bbf6329c27676323a899b7328575cc3f6c5f48cc (diff) | |
| parent | 28028b26b3371756811e95d894f709f4b1207c00 (diff) | |
Update upstream source from tag 'upstream/1.22.0'
Update to upstream version '1.22.0' with Debian dir a81ba1028908d08fc4866734c3df4a042bf9a511
Diffstat (limited to 'shared/systemd/src/basic/string-util.h')
| -rw-r--r-- | shared/systemd/src/basic/string-util.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/shared/systemd/src/basic/string-util.h b/shared/systemd/src/basic/string-util.h index 76767afc..04cc82b3 100644 --- a/shared/systemd/src/basic/string-util.h +++ b/shared/systemd/src/basic/string-util.h @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once -#include <alloca.h> #include <stdbool.h> #include <stddef.h> #include <string.h> @@ -45,6 +44,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]; } |