summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-10-26 13:41:31 +0200
committerTom Gundersen <teg@jklm.no>2013-10-26 13:42:38 +0200
commit5ecb28f69ef670c7e194b656b57fda6f8850f0ba (patch)
tree4bc840bfa0150aad62947e0ad6c8ede5a719602a
parent7d9cb4229cd5a47ab7dd50512fec018320294192 (diff)
STRV_FOREACH_BACWARDS: start at the tail of the list
Otherwise, the user would have to manually initialize the pointer. Nobody currently uses this code, so the change in behaviour sohuld be fine.
-rw-r--r--src/shared/strv.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/strv.h b/src/shared/strv.h
index f6fb033a8..571ea38a7 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -75,7 +75,8 @@ bool strv_overlap(char **a, char **b) _pure_;
for ((s) = (l); (s) && *(s); (s)++)
#define STRV_FOREACH_BACKWARDS(s, l) \
- for (; (l) && ((s) >= (l)); (s)--)
+ STRV_FOREACH(s, l) ; \
+ for ((s)--; (l) && ((s) >= (l)); (s)--)
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))