Index: runtime/bin/platform_linux.cc |
diff --git a/runtime/bin/platform_linux.cc b/runtime/bin/platform_linux.cc |
index 24cbfd3ebf58bd840cfffdfb17784544ffb332c7..c6dc3ccb15bcc74aa14208ac94ef7c111fa6d510 100644 |
--- a/runtime/bin/platform_linux.cc |
+++ b/runtime/bin/platform_linux.cc |
@@ -14,7 +14,6 @@ |
#include "bin/fdutils.h" |
- |
namespace dart { |
namespace bin { |
@@ -58,9 +57,12 @@ char** Platform::Environment(intptr_t* count) { |
// provide access to modifying environment variables. |
intptr_t i = 0; |
char** tmp = environ; |
- while (*(tmp++) != NULL) i++; |
+ while (*(tmp++) != NULL) { |
+ i++; |
+ } |
*count = i; |
- char** result = new char*[i]; |
+ char** result; |
+ result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result))); |
for (intptr_t current = 0; current < i; current++) { |
result[current] = environ[current]; |
} |
@@ -68,15 +70,11 @@ char** Platform::Environment(intptr_t* count) { |
} |
-void Platform::FreeEnvironment(char** env, intptr_t count) { |
- delete[] env; |
-} |
- |
- |
-char* Platform::ResolveExecutablePath() { |
+const char* Platform::ResolveExecutablePath() { |
return File::LinkTarget("/proc/self/exe"); |
} |
+ |
void Platform::Exit(int exit_code) { |
exit(exit_code); |
} |