1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 20:10:29 +01:00

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.
This commit is contained in:
John D Pell
2021-08-08 09:36:09 +02:00
committed by Carlos R. Mafra
parent 75f133285f
commit c060477d57
3 changed files with 8 additions and 10 deletions

View File

@@ -48,11 +48,7 @@ char *wgethomedir()
if (home) if (home)
return home; return home;
#ifdef HAVE_SECURE_GETENV tmp = GETENV("HOME");
tmp = secure_getenv("HOME");
#else
tmp = getenv("HOME");
#endif
if (tmp) { if (tmp) {
home = wstrdup(tmp); home = wstrdup(tmp);
return home; return home;

View File

@@ -58,11 +58,7 @@ const char *wusergnusteppath()
/* Value have been already computed, re-use it */ /* Value have been already computed, re-use it */
return path; return path;
#ifdef HAVE_SECURE_GETENV gspath = GETENV("WMAKER_USER_ROOT");
gspath = secure_getenv("WMAKER_USER_ROOT");
#else
gspath = getenv("WMAKER_USER_ROOT");
#endif
if (gspath) { if (gspath) {
gspath = wexpandpath(gspath); gspath = wexpandpath(gspath);
if (gspath) { if (gspath) {

View File

@@ -29,6 +29,12 @@
# define _(text) (text) # define _(text) (text)
#endif #endif
#ifdef HAVE_SECURE_GETENV
#define GETENV(x) secure_getenv((x))
#else
#define GETENV(x) getenv((x))
#endif
#endif /* WINGS_CONFIG_H_ */ #endif /* WINGS_CONFIG_H_ */