]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/sysusers/sysusers.c
sysusers: move global variables into a Context object
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Aug 2023 12:56:40 +0000 (14:56 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Aug 2023 15:34:00 +0000 (17:34 +0200)
commitd2a1673713bc04c54423a4d54d277f5c634647c2
tree20cc72667c067b915f646c79c5c44c42ca11e355
parent7a23cc4b66fde6311b087c3db2d961912850aeba
sysusers: move global variables into a Context object

Our coding style says static variables suck except for very special
cases, i.e. things like the log level or very per-process stuff, such as
parsed version of cmdline args and such. sysusers departed from that as
one of the very few exceptions in our codebases: it keeps its
operational state in global variables.

Address that. Introduce a Context object that carries the fields that so
far have been global, and pass it around as needed.

This has the nice effect that state and configuration is clearly
separated in code, and we can very clearly see which functions mangle
state and which ones do not.

No actual codeflow changes, just refactoring.
src/sysusers/sysusers.c