From: Lennart Poettering Date: Mon, 30 May 2016 15:59:43 +0000 (+0200) Subject: util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make... X-Git-Tag: v231.3~117 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=0e323032bfdd4b3cb434337a666e818f20b5beac util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make use of it everywhere --- diff --git a/src/basic/string-util.h b/src/basic/string-util.h index 139cc8c91..1209e1e2e 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;