Skip to content

Commit

Permalink
Merge pull request debauchee#847 from chewi/getenv
Browse files Browse the repository at this point in the history
Replace all instances of C's getenv with C++'s std::getenv
  • Loading branch information
p12tic authored Aug 22, 2020
2 parents b204520 + 7aa1104 commit 7dbfa63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/arch/unix/ArchDaemonUnix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ execSelfNonDaemonized()
}

bool alreadyDaemonized() {
return getenv("_BARRIER_DAEMONIZED") != NULL;
return std::getenv("_BARRIER_DAEMONIZED") != NULL;
}

#endif
Expand Down
4 changes: 2 additions & 2 deletions src/lib/common/unix/DataDirectories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "../DataDirectories.h"

#include <unistd.h> // sysconf
#include <stdlib.h> // getenv
#include <cstdlib> // getenv
#include <sys/types.h> // getpwuid(_r)
#include <pwd.h> // getpwuid(_r)

Expand Down Expand Up @@ -63,7 +63,7 @@ static std::string profile_basedir()
#ifdef WINAPI_XWINDOWS
// linux/bsd adheres to freedesktop standards
// 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)
return dir;
return unix_home() + "/.local/share";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/platform/XWindowsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ XWindowsScreen::openDisplay(const char* displayName)
{
// get the DISPLAY
if (displayName == NULL) {
displayName = getenv("DISPLAY");
displayName = std::getenv("DISPLAY");
if (displayName == NULL) {
displayName = ":0.0";
}
Expand Down

0 comments on commit 7dbfa63

Please sign in to comment.