diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-07 16:43:07 +0100 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-01-07 16:43:07 +0100 |
| commit | a524db35ac5c2099671d16318524e277e88631be (patch) | |
| tree | 54b29c42a317b9a13c3049ff85b14f7dce734cf6 /shared/systemd/src/basic/string-util.h | |
| parent | 6917e28d2d16138d6d497dc96efafe573b4b0979 (diff) | |
| parent | 724bcc5c7be3aed3646ed2b2989c34d438217176 (diff) | |
Merge branch 'upstream/latest' of https://salsa.debian.org/utopia-team/network-manager into upstream
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]; } |