Chromium Code Reviews| Index: runtime/bin/platform_macos.cc |
| diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc |
| index 2641ac1b9a97625dc8676c861f1f45537e8ac9b8..4adf7cf89c32d2808ee8eb2bb3c25fbe510cee7f 100644 |
| --- a/runtime/bin/platform_macos.cc |
| +++ b/runtime/bin/platform_macos.cc |
| @@ -75,15 +75,17 @@ bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) { |
| char** Platform::Environment(intptr_t* count) { |
| -#if TARGET_OS_IOS |
| - // TODO(iposva): On Mac (desktop), _NSGetEnviron() is used to access the |
| - // environ from shared libraries or bundles. This is present in crt_externs.h |
| - // which is unavailable on iOS. On iOS, everything is statically linked for |
| - // now. So arguably, accessing the environ directly with a "extern char |
| - // **environ" will work. But this approach is brittle as the target with this |
| - // CU could be a dynamic framework (introduced in iOS 8). A more elegant |
| - // approach needs to be devised. |
| - return NULL; |
| +#if defined(TARGET_OS_IOS) |
| + // TODO(zra,chinmaygarde): On iOS, environment varialbes are seldom used. Wire |
|
Ivan Posva
2016/03/31 17:27:53
variables
zra
2016/03/31 20:00:16
Done.
|
| + // this up if someone needs it. In the meantime, we return an empty array. |
| + char** result; |
| + result = reinterpret_cast<char**>(Dart_ScopeAllocate(1 * sizeof(*result))); |
| + if (result == NULL) { |
| + return NULL; |
| + } |
| + result[0] = NULL; |
| + *count = 0; |
| + return result; |
| #else |
| // Using environ directly is only safe as long as we do not |
| // provide access to modifying environment variables. |