strv: rework FOREACH_STRING() macro
authorLennart Poettering <lennart@poettering.net>
Tue, 15 Jan 2019 23:13:38 +0000 (00:13 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 16 Jan 2019 11:29:30 +0000 (12:29 +0100)
commit66a64081f82dfad90f2f9394a477820a2e3e6510
tree53fcefa1a2ee34f39f209ed18bd945a4af744d20
parentb2238e380e5f2fbcc129643b3fbd66f2828fd57c
strv: rework FOREACH_STRING() macro

So it's apparently problematic that we use STRV_MAKE() (i.e. a compound
initializer) outside of the {} block we use it in (and that includes
outside of the ({}) block, too). Hence, let's rework the macro to not
need that.

This also makes the macro shorter, which is definitely a good and more
readable. Moreover, it will now complain if the iterator is a "char*"
instead of a "const char*", which is good too.

Fixes: #11394
src/basic/strv.h