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.
This commit is contained in:
committed by
Yu Watanabe
parent
5cf84d2545
commit
e99ca14741
@@ -70,3 +70,5 @@ int setenv_systemd_exec_pid(bool update_only);
|
||||
int getenv_path_list(const char *name, char ***ret_paths);
|
||||
|
||||
int unsetenv_erase(const char *name);
|
||||
|
||||
int getenv_steal_erase(const char *name, char **ret);
|
||||
|
||||
Reference in New Issue
Block a user