Commit 0637780a authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot

char ** enivron is inconsistent on some platforms

Summary: The forward declaration of `extern char ** environ` is inconsistent on some platforms.

Reviewed By: strager, Orvid

Differential Revision: D4474856

fbshipit-source-id: c73a7c7d5a247e962fab06aeb65df7815f0e3bcb
parent 0ea1868e
...@@ -18,6 +18,13 @@ ...@@ -18,6 +18,13 @@
#include <cstdlib> #include <cstdlib>
#if defined(__APPLE__)
#include <TargetConditionals.h>
#if (TARGET_OS_OSX || TARGET_OS_SIMULATOR)
#include <crt_extern.h>
#endif
#endif
extern "C" { extern "C" {
#ifdef _WIN32 #ifdef _WIN32
// These are technically supposed to be defined linux/limits.h and // These are technically supposed to be defined linux/limits.h and
...@@ -34,7 +41,7 @@ int mkstemp(char* tn); ...@@ -34,7 +41,7 @@ int mkstemp(char* tn);
char* realpath(const char* path, char* resolved_path); char* realpath(const char* path, char* resolved_path);
int setenv(const char* name, const char* value, int overwrite); int setenv(const char* name, const char* value, int overwrite);
int unsetenv(const char* name); int unsetenv(const char* name);
#else #elif defined(__APPLE__) && (TARGET_OS_OSX || TARGET_OS_SIMULATOR)
extern char** environ; #define environ (*_NSGetEnviron())
#endif #endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment