Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@
#include "TThread.h"

// Standard
#include <assert.h>
#include <cassert>
#include <algorithm> // for std::count, std::remove
#include <climits>
#include <stdexcept>
#include <map>
#include <new>
#include <set>
#include <sstream>
#include <signal.h>
#include <stdlib.h> // for getenv
#include <string.h>
#include <csignal>
#include <cstdlib> // for getenv
#include <cstring>
#include <typeinfo>

// temp
Expand Down Expand Up @@ -229,7 +229,7 @@ class TExceptionHandlerImp : public TExceptionHandler {
gInterpreter->ClearFileBusy();
}

if (!getenv("CPPYY_CRASH_QUIET"))
if (!std::getenv("CPPYY_CRASH_QUIET"))
do_trace(sig);

// jump back, if catch point set
Expand Down Expand Up @@ -263,7 +263,7 @@ class ApplicationStarter {
g_globalidx[nullptr] = 0;

// disable fast path if requested
if (getenv("CPPYY_DISABLE_FASTPATH")) gEnableFastPath = false;
if (std::getenv("CPPYY_DISABLE_FASTPATH")) gEnableFastPath = false;

// fill the set of STL names
const char* stl_names[] = {"allocator", "auto_ptr", "bad_alloc", "bad_cast",
Expand Down Expand Up @@ -296,7 +296,7 @@ class ApplicationStarter {

// set opt level (default to 2 if not given; Cling itself defaults to 0)
int optLevel = 2;
if (getenv("CPPYY_OPT_LEVEL")) optLevel = atoi(getenv("CPPYY_OPT_LEVEL"));
if (std::getenv("CPPYY_OPT_LEVEL")) optLevel = atoi(std::getenv("CPPYY_OPT_LEVEL"));
if (optLevel != 0) {
std::ostringstream s;
s << "#pragma cling optimize " << optLevel;
Expand Down Expand Up @@ -324,7 +324,7 @@ class ApplicationStarter {
gInterpreter->Declare("namespace __cppyy_internal { struct Sep; }");

// retrieve all initial (ROOT) C++ names in the global scope to allow filtering later
if (!getenv("CPPYY_NO_ROOT_FILTER")) {
if (!std::getenv("CPPYY_NO_ROOT_FILTER")) {
gROOT->GetListOfGlobals(true); // force initialize
gROOT->GetListOfGlobalFunctions(true); // id.
std::set<std::string> initial;
Expand Down
8 changes: 4 additions & 4 deletions core/clingutils/src/TClingUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <algorithm>
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <cstdio>
#include <unordered_set>
#include <cctype>

Expand Down Expand Up @@ -5188,7 +5188,7 @@ static void replaceEnvVars(const char* varname, std::string& txt)
endVar = endVarName;
}

const char* val = getenv(txt.substr(beginVarName,
const char* val = std::getenv(txt.substr(beginVarName,
endVarName - beginVarName).c_str());
if (!val) val = "";

Expand All @@ -5210,7 +5210,7 @@ static void replaceEnvVars(const char* varname, std::string& txt)

void ROOT::TMetaUtils::SetPathsForRelocatability(std::vector<std::string>& clingArgs )
{
const char* envInclPath = getenv("ROOT_INCLUDE_PATH");
const char* envInclPath = std::getenv("ROOT_INCLUDE_PATH");

if (!envInclPath)
return;
Expand Down
14 changes: 7 additions & 7 deletions core/dictgen/src/rootcling_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2805,11 +2805,11 @@ void CreateDictHeader(std::ostream &dictStream, const std::string &main_dictname
// write one and include in there a few things for backward
// compatibility.
<< "\n/*******************************************************************/\n"
<< "#include <stddef.h>\n"
<< "#include <stdio.h>\n"
<< "#include <stdlib.h>\n"
<< "#include <string.h>\n"
<< "#include <assert.h>\n"
<< "#include <cstddef>\n"
<< "#include <cstdio>\n"
<< "#include <cstdlib>\n"
<< "#include <cstring>\n"
<< "#include <cassert>\n"
<< "#define G__DICTIONARY\n"
<< "#include \"ROOT/RConfig.hxx\"\n"
<< "#include \"TClass.h\"\n"
Expand Down Expand Up @@ -3661,7 +3661,7 @@ static void MaybeSuppressWin32CrashDialogs() {
// Suppress error dialogs to avoid hangs on build nodes.
// One can use an environment variable (Cling_GuiOnAssert) to enable
// the error dialogs.
const char *EnablePopups = getenv("Cling_GuiOnAssert");
const char *EnablePopups = std::getenv("Cling_GuiOnAssert");
if (EnablePopups == nullptr || EnablePopups[0] == '0') {
::_set_error_mode(_OUT_TO_STDERR);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
Expand Down Expand Up @@ -6018,7 +6018,7 @@ int GenReflexMain(int argc, char **argv)
//std::string verbosityOption("-v4"); // To be uncommented for the testing phase. It should be -v
std::string verbosityOption("-v2");
if (options[SILENT]) verbosityOption = "-v0";
if (options[VERBOSE] || getenv ("VERBOSE")) verbosityOption = "-v3";
if (options[VERBOSE] || std::getenv ("VERBOSE")) verbosityOption = "-v3";
if (options[DEBUG]) verbosityOption = "-v4";

genreflex::verbose = verbosityOption == "-v4";
Expand Down
9 changes: 5 additions & 4 deletions core/foundation/src/FoundationUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

#include <algorithm>
#include <cassert>
#include <cstdlib>

#include <errno.h>
#include <string.h>
#include <cerrno>
#include <cstring>

#ifdef _WIN32
#include <direct.h>
Expand Down Expand Up @@ -150,7 +151,7 @@ const std::string& GetFallbackRootSys() {

#ifdef ROOTPREFIX
static bool IgnorePrefix() {
static bool ignorePrefix = ::getenv("ROOTIGNOREPREFIX");
static bool ignorePrefix = std::getenv("ROOTIGNOREPREFIX");
return ignorePrefix;
}
#endif
Expand All @@ -164,7 +165,7 @@ const std::string& GetRootSys() {
#endif
static std::string rootsys;
if (rootsys.empty()) {
if (const char* envValue = ::getenv("ROOTSYS")) {
if (const char* envValue = std::getenv("ROOTSYS")) {
rootsys = envValue;
// We cannot use gSystem->UnixPathName.
ConvertToUnixPath(rootsys);
Expand Down
2 changes: 1 addition & 1 deletion core/metacling/src/TCling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3547,7 +3547,7 @@ void TCling::RegisterLoadedSharedLibrary(const char* filename)
// Check that this is not a system library
static const int bufsize = 260;
char posixwindir[bufsize];
char *windir = getenv("WINDIR");
char *windir = std::getenv("WINDIR");
if (windir)
cygwin_conv_path(CCP_WIN_A_TO_POSIX, windir, posixwindir, bufsize);
else
Expand Down
4 changes: 2 additions & 2 deletions core/rootcling_stage1/src/rootcling_stage1.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ static void (*dlsymaddr)() = &usedToIdentifyRootClingByDlSym;
ROOT::Internal::RootCling::TROOTSYSSetter gROOTSYSSetter;

static const char *GetIncludeDir() {
auto renv = getenv("ROOTSYS");
auto renv = std::getenv("ROOTSYS");
if (!renv)
return nullptr;
static std::string incdir = std::string(renv) + "/include";
return incdir.c_str();
}

static const char *GetEtcDir() {
auto renv = getenv("ROOTSYS");
auto renv = std::getenv("ROOTSYS");
if (!renv)
return nullptr;
static std::string etcdir = std::string(renv) + "/etc";
Expand Down
8 changes: 4 additions & 4 deletions core/textinput/src/textinput/TerminalDisplayUnix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include "textinput/TerminalDisplayUnix.h"

#include <fcntl.h>
#include <stdio.h>
#include <cstdio>
// putenv not in cstdlib on Solaris
#include <stdlib.h>
#include <cstdlib>
#include <unistd.h>
#include <sys/ioctl.h>
#include <termios.h>
Expand Down Expand Up @@ -118,7 +118,7 @@ namespace textinput {
TerminalConfigUnix::Get().TIOS()->c_lflag &= ~(ECHO);
TerminalConfigUnix::Get().TIOS()->c_lflag |= ECHOCTL|ECHOKE|ECHOE;
#endif
const char* TERM = getenv("TERM");
const char* TERM = std::getenv("TERM");
if (TERM && strstr(TERM, "256")) {
fNColors = 256;
}
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace textinput {
}
#else
// try $COLUMNS
const char* COLUMNS = getenv("COLUMNS");
const char* COLUMNS = std::getenv("COLUMNS");
if (COLUMNS) {
long width = atol(COLUMNS);
if (width > 4 && width < 1024*16) {
Expand Down
6 changes: 3 additions & 3 deletions core/unix/src/TUnixSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
//#define G__OLDEXPAND

#include <unistd.h>
#include <stdlib.h>
#include <cstdlib>
#include <sys/types.h>
#if defined(R__SUN) || defined(R__AIX) || \
defined(R__LINUX) || defined(R__SOLARIS) || \
Expand Down Expand Up @@ -704,7 +704,7 @@ void TUnixSystem::SetDisplay()
}
}
#ifndef R__HAS_COCOA
if (!gROOT->IsBatch() && !getenv("DISPLAY")) {
if (!gROOT->IsBatch() && !std::getenv("DISPLAY")) {
Error("SetDisplay", "Can't figure out DISPLAY, set it manually\n"
"In case you run a remote ssh session, restart your ssh session with:\n"
"=========> ssh -Y");
Expand Down Expand Up @@ -2139,7 +2139,7 @@ void TUnixSystem::Setenv(const char *name, const char *value)

const char *TUnixSystem::Getenv(const char *name)
{
return ::getenv(name);
return std::getenv(name);
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
24 changes: 12 additions & 12 deletions core/winnt/src/TWinNTSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
#include <ctype.h>
#include <float.h>
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include <csignal>
#include <cstdio>
#include <cerrno>
#include <lm.h>
#include <dbghelp.h>
#include <Tlhelp32.h>
Expand All @@ -61,7 +61,7 @@
#include <list>
#include <shlobj.h>
#include <conio.h>
#include <time.h>
#include <ctime>
#include <bcrypt.h>
#include <chrono>
#include <thread>
Expand Down Expand Up @@ -827,7 +827,7 @@ namespace {
// determine the fileopen.C file path:
TString fileopen = "fileopen.C";
TString rootmacrodir = "macros";
sys->PrependPathName(getenv("ROOTSYS"), rootmacrodir);
sys->PrependPathName(std::getenv("ROOTSYS"), rootmacrodir);
sys->PrependPathName(rootmacrodir.Data(), fileopen);

if (regROOTwrite) {
Expand Down Expand Up @@ -1283,7 +1283,7 @@ Int_t TWinNTSystem::GetCryptoRandom(void *buf, Int_t len)
const char *TWinNTSystem::HostName()
{
if (fHostname == "")
fHostname = ::getenv("COMPUTERNAME");
fHostname = std::getenv("COMPUTERNAME");
if (fHostname == "") {
// This requires a DNS query - but we need it for fallback
char hn[64];
Expand Down Expand Up @@ -2225,23 +2225,23 @@ std::string TWinNTSystem::GetHomeDirectory(const char *userName) const
void TWinNTSystem::FillWithHomeDirectory(const char *userName, char *mydir) const
{
const char *h = nullptr;
if (!(h = ::getenv("home"))) h = ::getenv("HOME");
if (!(h = std::getenv("home"))) h = std::getenv("HOME");

if (h) {
strlcpy(mydir, h,kMAXPATHLEN);
} else {
// for Windows NT HOME might be defined as either $(HOMESHARE)/$(HOMEPATH)
// or $(HOMEDRIVE)/$(HOMEPATH)
h = ::getenv("HOMESHARE");
if (!h) h = ::getenv("HOMEDRIVE");
h = std::getenv("HOMESHARE");
if (!h) h = std::getenv("HOMEDRIVE");
if (h) {
strlcpy(mydir, h,kMAXPATHLEN);
h = ::getenv("HOMEPATH");
h = std::getenv("HOMEPATH");
if(h) strlcat(mydir, h,kMAXPATHLEN);
}
// on Windows Vista HOME is usually defined as $(USERPROFILE)
if (!h) {
h = ::getenv("USERPROFILE");
h = std::getenv("USERPROFILE");
if (h) strlcpy(mydir, h,kMAXPATHLEN);
}
}
Expand Down Expand Up @@ -3861,7 +3861,7 @@ void TWinNTSystem::Setenv(const char *name, const char *value)

const char *TWinNTSystem::Getenv(const char *name)
{
const char *env = ::getenv(name);
const char *env = std::getenv(name);
if (!env) {
if (::_stricmp(name,"home") == 0 ) {
env = HomeDirectory();
Expand Down
10 changes: 5 additions & 5 deletions documentation/doxygen/filter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
#include <cstring>
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdarg.h>
#include <cstdlib>
#include <cstdarg>
#include <memory>

using std::string;
Expand Down Expand Up @@ -161,15 +161,15 @@ int main(int argc, char *argv[])
gCwd = gFileName.substr(0,last);

// Retrieve the output directory
gOutDir = getenv("DOXYGEN_OUTPUT_DIRECTORY");
gOutDir = std::getenv("DOXYGEN_OUTPUT_DIRECTORY");
ReplaceAll(gOutDir,"\"","");

// Retrieve the source directory
gSourceDir = getenv("DOXYGEN_SOURCE_DIRECTORY");
gSourceDir = std::getenv("DOXYGEN_SOURCE_DIRECTORY");
ReplaceAll(gSourceDir,"\"","");

// Retrieve the python executable
gPythonExec = getenv("Python3_EXECUTABLE");
gPythonExec = std::getenv("Python3_EXECUTABLE");
ReplaceAll(gPythonExec,"\"","");

// Open the input file name.
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/lib/Interpreter/CIFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ namespace {
clang::HeaderSearchOptions& HSOpts = CI.getHeaderSearchOpts();
// Register prebuilt module paths where we will lookup module files.
addPrebuiltModulePaths(HSOpts,
getPathsFromEnv(getenv("CLING_PREBUILT_MODULE_PATH")));
getPathsFromEnv(std::getenv("CLING_PREBUILT_MODULE_PATH")));

// Register all modulemaps necessary for cling to run. If we have specified
// -fno-implicit-module-maps then we have to add them explicitly to the list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace cling {
// Behaviour is to not add paths that don't exist...In an interpreted env
// does this make sense? Path could pop into existance at any time.
for (const char* Var : kSysLibraryEnv) {
if (const char* Env = ::getenv(Var)) {
if (const char* Env = std::getenv(Var)) {
llvm::SmallVector<llvm::StringRef, 10> CurPaths;
SplitPaths(Env, CurPaths, utils::kPruneNonExistant, platform::kEnvDelim);
for (const auto& Path : CurPaths)
Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/lib/UserInterface/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace {
};

llvm::SmallString<512> GetHistoryFilePath() {
if (getenv("CLING_NOHISTORY")) {
if (std::getenv("CLING_NOHISTORY")) {
return {};
}

Expand Down
2 changes: 1 addition & 1 deletion interpreter/cling/lib/Utils/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool ExpandEnvVars(std::string& Str, bool Path) {

std::string EnvVar = Str.substr(DPos + 1, Length -1); //"HOME"
std::string FullPath;
if (const char* Tok = ::getenv(EnvVar.c_str()))
if (const char* Tok = std::getenv(EnvVar.c_str()))
FullPath = Tok;

Str.replace(DPos, Length, FullPath);
Expand Down
Loading
Loading