summaryrefslogtreecommitdiff
path: root/src/basic/string-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-30 17:59:43 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-30 17:59:43 +0200
commit3c6f7c340237262b560586cf7cf06be957d4352f (patch)
tree6eb58f6d2ef4843256139d939dbcbc91da40734c /src/basic/string-util.h
parentc6f8d17de0c36f94213496e2c9fd013f113ebe08 (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.h4
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;