chiark / gitweb /
util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make...
[elogind.git] / src / basic / string-util.h
index 139cc8c91b42bb551fed22c2215fd4922b272e49..1209e1e2e14c11853b526891d31b34584c36db68 100644 (file)
@@ -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;