Merge pull request #100 from hughbe/sysconf-another
Fix another use of `sysconf` instead of platform independent c++ 11
diff --git a/lib/BuildSystem/LaneBasedExecutionQueue.cpp b/lib/BuildSystem/LaneBasedExecutionQueue.cpp
index 054a230..8dc1c76 100644
--- a/lib/BuildSystem/LaneBasedExecutionQueue.cpp
+++ b/lib/BuildSystem/LaneBasedExecutionQueue.cpp
@@ -43,9 +43,11 @@
using namespace llbuild;
using namespace llbuild::buildsystem;
+#if !defined(_WIN32)
extern "C" {
extern char **environ;
}
+#endif
namespace {
@@ -324,7 +326,7 @@
std::vector<const char*> env(environment.size() + 1);
char* const* envp = nullptr;
if (environment.empty()) {
- envp = ::environ;
+ envp = environ;
} else {
for (size_t i = 0; i != envStorage.size(); ++i) {
env[i] = envStorage[i].c_str();
diff --git a/lib/Commands/NinjaBuildCommand.cpp b/lib/Commands/NinjaBuildCommand.cpp
index 8d3da41..e49a2b9 100644
--- a/lib/Commands/NinjaBuildCommand.cpp
+++ b/lib/Commands/NinjaBuildCommand.cpp
@@ -52,9 +52,11 @@
using namespace llbuild::basic;
using namespace llbuild::commands;
+#if !defined(_WIN32)
extern "C" {
extern char **environ;
}
+#endif
static uint64_t getTimeInMicroseconds() {
llvm::sys::TimeValue now = llvm::sys::TimeValue::now();
@@ -1251,7 +1253,7 @@
if (posix_spawn(&pid, args[0], /*file_actions=*/&fileActions,
/*attrp=*/&attributes, const_cast<char**>(args),
- ::environ) != 0) {
+ environ) != 0) {
context.emitError("unable to spawn process (%s)", strerror(errno));
return false;
}