sd-bus: stop using the result of an assignment as an operand of &&
authorEvegeny Vereshchagin <evvers@ya.ru>
Tue, 26 Jun 2018 02:32:44 +0000 (02:32 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 28 Jun 2018 04:17:29 +0000 (13:17 +0900)
This makes OBJECT_PATH_FOREACH_PREFIX consistent with PATH_FOREACH_PREFIX
and also fixes 7 alerts reported by LGTM at
https://lgtm.com/projects/g/systemd/systemd/snapshot/ac0a08700344a5690803df8dd80e8bb5013184a5/files/src/libsystemd/sd-bus/bus-objects.c?sort=name&dir=ASC&mode=heatmap&showExcluded=true#V1383

src/libsystemd/sd-bus/bus-internal.h

index 2087ef8..4c07d55 100644 (file)
@@ -384,7 +384,7 @@ void bus_close_io_fds(sd_bus *b);
 
 #define OBJECT_PATH_FOREACH_PREFIX(prefix, path)                        \
         for (char *_slash = ({ strcpy((prefix), (path)); streq((prefix), "/") ? NULL : strrchr((prefix), '/'); }) ; \
-             _slash && !(_slash[(_slash) == (prefix)] = 0);             \
+             _slash && ((_slash[(_slash) == (prefix)] = 0), true);       \
              _slash = streq((prefix), "/") ? NULL : strrchr((prefix), '/'))
 
 /* If we are invoking callbacks of a bus object, ensure unreffing the