From b9d147fb150c5e0960bc43ad5f3f843487f816f7 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Tue, 12 Jan 2021 13:27:10 +0100 Subject: environment: make `getenv_safe()` a public function The `getenv_safe()` helper function helps to safely retrieve multiple environment values without the need to depend on platform-specific behaviour for the return value's lifetime. We'll make use of this function in a following patch, so let's make it available by making it non-static and adding a declaration. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- environment.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 environment.h (limited to 'environment.h') diff --git a/environment.h b/environment.h new file mode 100644 index 0000000000..d438b5c8f3 --- /dev/null +++ b/environment.h @@ -0,0 +1,12 @@ +#ifndef ENVIRONMENT_H +#define ENVIRONMENT_H + +#include "strvec.h" + +/* + * Wrapper of getenv() that returns a strdup value. This value is kept + * in argv to be freed later. + */ +const char *getenv_safe(struct strvec *argv, const char *name); + +#endif -- cgit v1.2.3