(backport) strv: rework FOREACH_STRING() macro
authorLennart Poettering <lennart@poettering.net>
Tue, 15 Jan 2019 23:13:38 +0000 (00:13 +0100)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Mon, 12 Feb 2024 15:37:44 +0000 (16:37 +0100)
commit465fa42a66f61d89fc3593c99ed16e55f1e478d9
tree71ec6229de02a1b466360ea84cbd80e806351f51
parent3fd7fe3bace1133b4db7313dd19c9ef38e7a4aa2
(backport) 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
Change-Id: Ibc21cdd5583c3b6a079b8691bbac5e076819432a
src/basic/strv.h