]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: use a dynamic check for valgrind
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 Feb 2023 10:35:25 +0000 (11:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 22 Feb 2023 10:39:44 +0000 (11:39 +0100)
commit3dc6b0fcb2ca7231cca754175f625274a1230f3a
treec773e4345c95323dec056baec3262972b60ef402
parent50b35193ec6f8f342364742a69a607e967b39b7f
sd-journal: use a dynamic check for valgrind

I left this one as a separate commit because it is more involved.
We want people to compile with valgrind support, but we don't want to
use a slow hash function unless we're actually running under valgrind.
So the compile-time check is changed to a runtime check. When compiled
with optimization, the compiler should elide the checks on the constants,
and only leave the check for RUNNING_ON_VALGRIND. It is wrapped with
_unlikely_ so that the else branch is put in the hot path.
src/libsystemd/sd-journal/lookup3.c