diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-05-30 17:59:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-05-30 17:59:43 +0200 |
commit | 3c6f7c340237262b560586cf7cf06be957d4352f (patch) | |
tree | 6eb58f6d2ef4843256139d939dbcbc91da40734c /src/basic/string-util.h | |
parent | c6f8d17de0c36f94213496e2c9fd013f113ebe08 (diff) |
util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make use of it everywhere
Diffstat (limited to 'src/basic/string-util.h')
-rw-r--r-- | src/basic/string-util.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/string-util.h b/src/basic/string-util.h index 139cc8c91b..1209e1e2e1 100644 --- a/src/basic/string-util.h +++ b/src/basic/string-util.h @@ -66,6 +66,10 @@ static inline bool isempty(const char *p) { return !p || !p[0]; } +static inline const char *empty_to_null(const char *p) { + return isempty(p) ? NULL : p; +} + static inline char *startswith(const char *s, const char *prefix) { size_t l; |