Files
systemd/src/shared
Zbigniew Jędrzejewski-Szmek 31ddd87da0 tree-wide: extend verbs functions with extra per-verb data parameter
We often have a pattern where the same verb function is used for
multiple actions. This leads to an antipattern where we figure out what
action needs to be taken from argv[0] multiple times: often once in
parse_argv() to figure out what options are allowed, then once again
implicitly in dispatch_verb(), and then again in the action verb itself.
Let's allow passing a parameter into the verb to simplify this.

This matches a pattern we have in conf-parser.h, where we have both
void *userdata (more global) and void *data (per-config item). Here,
I opted for uintptr_t userdata. It seems that most of the time we'll
want to just pass an enum value. This works OK with no casts. I also
tried a void* and union. In both cases, much more boilerplate is needed:
either a cast or a macro to help avoid compiler warnings. uintptr_t
seems generic enough to cover foreseeable usecases with no fuss.

This is a noop refactoring. See next commit for an example.
2026-03-18 10:28:47 +00:00
..
…
…
2025-11-09 18:13:44 +09:00
2025-12-15 08:50:13 +09:00
…
…
2026-01-05 21:29:52 +09:00
2026-01-05 21:29:52 +09:00
2026-01-03 20:08:12 +01:00
2026-01-21 15:49:58 +01:00
2026-01-05 21:29:52 +09:00
2026-01-05 21:29:52 +09:00
2026-02-20 16:22:00 +09:00
2026-02-20 16:22:00 +09:00
2025-10-16 03:26:39 -07:00
2025-11-25 17:34:48 +01:00
2025-11-15 07:44:24 +01:00
2025-12-15 08:50:13 +09:00
2025-12-15 08:50:13 +09:00
2026-02-12 09:46:37 +01:00
2025-12-15 08:50:13 +09:00
2025-12-15 08:50:13 +09:00
…
…