diff options
author | 0xAX <0xAX@users.noreply.github.com> | 2016-06-28 00:26:07 +0300 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-06-27 23:26:07 +0200 |
commit | f9d14060ae09c7597a80c01188a6b15f33f9bcd3 (patch) | |
tree | bf6ad07e2325b06b393fcd1efbdacf9215e9be6f /src/basic/strv.h | |
parent | 2027927b1002a74d24300704a655614f8ea48e45 (diff) |
basic/strv: introduce STRV_IGNORE macro (#3601)
to hide casting of '-1' strings and make code cleaner.
Diffstat (limited to 'src/basic/strv.h')
-rw-r--r-- | src/basic/strv.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/strv.h b/src/basic/strv.h index f61bbb5386..683ce83a2a 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -69,8 +69,10 @@ bool strv_equal(char **a, char **b); char **strv_new(const char *x, ...) _sentinel_; char **strv_new_ap(const char *x, va_list ap); +#define STRV_IGNORE ((const char *) -1) + static inline const char* STRV_IFNOTNULL(const char *x) { - return x ? x : (const char *) -1; + return x ? x : STRV_IGNORE; } static inline bool strv_isempty(char * const *l) { |