diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-05-30 17:59:43 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-06-16 10:12:59 +0200 |
commit | 0e323032bfdd4b3cb434337a666e818f20b5beac (patch) | |
tree | bdaca1ab067ba48522d51ada28cc39c51ea06568 /src | |
parent | b95989ce64f0ac3ef66972ecc87d65275555f39b (diff) |
util-lib: make localed's nonempty() generic, rename it to empty_to_null() and make use of it everywhere
Diffstat (limited to 'src')
-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 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; |