Merge pull request #847 from chewi/getenv

Replace all instances of C's getenv with C++'s std::getenv
This commit is contained in:
Povilas Kanapickas 2020-08-22 21:20:30 +03:00 committed by GitHub
commit 7dbfa63a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@ execSelfNonDaemonized()
} }
bool alreadyDaemonized() { bool alreadyDaemonized() {
return getenv("_BARRIER_DAEMONIZED") != NULL; return std::getenv("_BARRIER_DAEMONIZED") != NULL;
} }
#endif #endif

View File

@ -18,7 +18,7 @@
#include "../DataDirectories.h" #include "../DataDirectories.h"
#include <unistd.h> // sysconf #include <unistd.h> // sysconf
#include <stdlib.h> // getenv #include <cstdlib> // getenv
#include <sys/types.h> // getpwuid(_r) #include <sys/types.h> // getpwuid(_r)
#include <pwd.h> // getpwuid(_r) #include <pwd.h> // getpwuid(_r)
@ -63,7 +63,7 @@ static std::string profile_basedir()
#ifdef WINAPI_XWINDOWS #ifdef WINAPI_XWINDOWS
// linux/bsd adheres to freedesktop standards // linux/bsd adheres to freedesktop standards
// https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html // https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
const char* dir = getenv("XDG_DATA_HOME"); const char* dir = std::getenv("XDG_DATA_HOME");
if (dir != NULL) if (dir != NULL)
return dir; return dir;
return unix_home() + "/.local/share"; return unix_home() + "/.local/share";

View File

@ -877,7 +877,7 @@ XWindowsScreen::openDisplay(const char* displayName)
{ {
// get the DISPLAY // get the DISPLAY
if (displayName == NULL) { if (displayName == NULL) {
displayName = getenv("DISPLAY"); displayName = std::getenv("DISPLAY");
if (displayName == NULL) { if (displayName == NULL) {
displayName = ":0.0"; displayName = ":0.0";
} }