]> git.ipfire.org Git - thirdparty/systemd.git/commit
basic/hashmap: tweak code to avoid pointless gcc warning
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 2 Feb 2018 13:34:00 +0000 (14:34 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 2 Feb 2018 13:34:00 +0000 (14:34 +0100)
commitafbbc0682ed892aa4d616e7df7ec4ff797eaa529
tree594007864abc18fec21a2827f91f9ce73d6c99f9
parent75aaade16b00ff519fbaedb4cc773b654c11a34a
basic/hashmap: tweak code to avoid pointless gcc warning

gcc says:
[196/1142] Compiling C object 'src/basic/basic@sta/hashmap.c.o'.
../src/basic/hashmap.c: In function ‘cachemem_maintain’:
../src/basic/hashmap.c:1913:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
                 mem->active = r = true;
                 ^~~

which conflates two things: the first is transitive assignent a = b = c = d;
the second is assignment of the value of an expression, which happens to be a
an assignment expression here, and boolean. While the second _should_ be
parenthesized, the first should _not_, and it's more natural to understand
our code as the first, and gcc should treat this as an exception and not emit
the warning. But since it's a while until this will be fixed, let's update
our code too.
src/basic/hashmap.c