]> git.ipfire.org Git - thirdparty/systemd.git/commit
shared/verbs: allow multiple verbs to be handled by a single function
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Tue, 24 Mar 2026 22:33:49 +0000 (23:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Wed, 25 Mar 2026 01:02:25 +0000 (02:02 +0100)
commit7be9bb1845a8a521d16492213110eb043a7bb0c6
tree79f072336da2544199fbbc0abb44bf456acf75c9
parentca6c3bd0e54971de92ff7e270ec7aa8a3d109145
shared/verbs: allow multiple verbs to be handled by a single function

With the uintptr_t data parameter, it is actually quite nice to have
VERB(do_impl, "name-a", …)
VERB(do_impl, "name-b", …)
int do_impl(…) { … }

To make this work, the do_impl_data struct needs to have a unique name and
we also need to suppress the warning about the forward declaration for
do_impl being repeated. I think it's fine to suppress the warning, it's
not needed for anything. If somebody declares the function with the same
name by mistake, the implementations are going to conflict too.
src/fundamental/macro-fundamental.h
src/shared/verbs.h