summaryrefslogtreecommitdiff
path: root/src/basic/string-util.h
diff options
context:
space:
mode:
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;