]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/env-util.h
env-util: replace unsetenv_erase() by new getenv_steal_erase() helper
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Feb 2022 23:08:39 +0000 (00:08 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 20 Feb 2022 03:38:06 +0000 (12:38 +0900)
commite99ca1474145f7fad38bb0255d344f4ad7717ef5
tree4c8662608ea96da642bc293d4838deeac860ed18
parent5cf84d2545fc314d970e0eded0258d1650bed3cd
env-util: replace unsetenv_erase() by new getenv_steal_erase() helper

The new helper combines a bunch of steps every invocation of
unsetenv_erase() did so far: getenv() + strdup() + unsetenv_erase().
Let's unify this into one helper that is harder to use incorrectly. It's
in inspired by TAKE_PTR() in a way: get the env var out and invalidate
where it was before.
src/basic/env-util.c
src/basic/env-util.h
src/cryptenroll/cryptenroll-password.c
src/cryptenroll/cryptenroll.c
src/cryptsetup/cryptsetup-fido2.c
src/cryptsetup/cryptsetup.c
src/home/homectl.c
src/shared/pkcs11-util.c
src/test/test-env-util.c