summaryrefslogtreecommitdiff
path: root/src/basic/strv.c
diff options
context:
space:
mode:
author0xAX <0xAX@users.noreply.github.com>2016-06-28 00:26:07 +0300
committerMartin Pitt <martin.pitt@ubuntu.com>2016-06-27 23:26:07 +0200
commitf9d14060ae09c7597a80c01188a6b15f33f9bcd3 (patch)
treebf6ad07e2325b06b393fcd1efbdacf9215e9be6f /src/basic/strv.c
parent2027927b1002a74d24300704a655614f8ea48e45 (diff)
basic/strv: introduce STRV_IGNORE macro (#3601)
to hide casting of '-1' strings and make code cleaner.
Diffstat (limited to 'src/basic/strv.c')
-rw-r--r--src/basic/strv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 4e8153421a..53298268f4 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -139,16 +139,16 @@ char **strv_new_ap(const char *x, va_list ap) {
va_list aq;
/* As a special trick we ignore all listed strings that equal
- * (const char*) -1. This is supposed to be used with the
+ * STRV_IGNORE. This is supposed to be used with the
* STRV_IFNOTNULL() macro to include possibly NULL strings in
* the string list. */
if (x) {
- n = x == (const char*) -1 ? 0 : 1;
+ n = x == STRV_IGNORE ? 0 : 1;
va_copy(aq, ap);
while ((s = va_arg(aq, const char*))) {
- if (s == (const char*) -1)
+ if (s == STRV_IGNORE)
continue;
n++;
@@ -162,7 +162,7 @@ char **strv_new_ap(const char *x, va_list ap) {
return NULL;
if (x) {
- if (x != (const char*) -1) {
+ if (x != STRV_IGNORE) {
a[i] = strdup(x);
if (!a[i])
goto fail;
@@ -171,7 +171,7 @@ char **strv_new_ap(const char *x, va_list ap) {
while ((s = va_arg(ap, const char*))) {
- if (s == (const char*) -1)
+ if (s == STRV_IGNORE)
continue;
a[i] = strdup(s);