chiark / gitweb /
STRV_FOREACH_BACWARDS: start at the tail of the list
[elogind.git] / src / shared / strv.h
index f6fb033a8ca3a6f325d0480ae97b61f0f247b6fa..571ea38a7ff046b4ac804116b267aaaae93e9d1c 100644 (file)
@@ -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))