From c060477d57ec5a7d3a7c5f6c78d8a613fc068aa4 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sun, 8 Aug 2021 09:36:09 +0200 Subject: [PATCH] WINGs: Simplify use of HAVE_SECURE_GETENV Define the macro GETENV(x) instead of sprinkling code with #ifdef HAVE_SECURE_GETENV everytime we want to use it. --- WINGs/findfile.c | 6 +----- WINGs/userdefaults.c | 6 +----- WINGs/wconfig.h | 6 ++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/WINGs/findfile.c b/WINGs/findfile.c index a1e1b024..0726105b 100644 --- a/WINGs/findfile.c +++ b/WINGs/findfile.c @@ -48,11 +48,7 @@ char *wgethomedir() if (home) return home; -#ifdef HAVE_SECURE_GETENV - tmp = secure_getenv("HOME"); -#else - tmp = getenv("HOME"); -#endif + tmp = GETENV("HOME"); if (tmp) { home = wstrdup(tmp); return home; diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c index 80feef98..cef542e4 100644 --- a/WINGs/userdefaults.c +++ b/WINGs/userdefaults.c @@ -58,11 +58,7 @@ const char *wusergnusteppath() /* Value have been already computed, re-use it */ return path; -#ifdef HAVE_SECURE_GETENV - gspath = secure_getenv("WMAKER_USER_ROOT"); -#else - gspath = getenv("WMAKER_USER_ROOT"); -#endif + gspath = GETENV("WMAKER_USER_ROOT"); if (gspath) { gspath = wexpandpath(gspath); if (gspath) { diff --git a/WINGs/wconfig.h b/WINGs/wconfig.h index 995260a8..6e5fe1e0 100644 --- a/WINGs/wconfig.h +++ b/WINGs/wconfig.h @@ -29,6 +29,12 @@ # define _(text) (text) #endif +#ifdef HAVE_SECURE_GETENV +#define GETENV(x) secure_getenv((x)) +#else +#define GETENV(x) getenv((x)) +#endif + #endif /* WINGS_CONFIG_H_ */