| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return NULL; | 145 return NULL; |
| 146 } | 146 } |
| 147 if (n < len) { | 147 if (n < len) { |
| 148 len = n; | 148 len = n; |
| 149 } | 149 } |
| 150 char* result = reinterpret_cast<char*>(malloc(len + 1)); | 150 char* result = reinterpret_cast<char*>(malloc(len + 1)); |
| 151 if (result == NULL) { | 151 if (result == NULL) { |
| 152 return NULL; | 152 return NULL; |
| 153 } | 153 } |
| 154 result[len] = '\0'; | 154 result[len] = '\0'; |
| 155 return reinterpret_cast<char*>(memcpy(result, s, len)); | 155 return reinterpret_cast<char*>(memmove(result, s, len)); |
| 156 #else // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... | 156 #else // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... |
| 157 return strndup(s, n); | 157 return strndup(s, n); |
| 158 #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... | 158 #endif // !defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || ... |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 void OS::Print(const char* format, ...) { | 162 void OS::Print(const char* format, ...) { |
| 163 va_list args; | 163 va_list args; |
| 164 va_start(args, format); | 164 va_start(args, format); |
| 165 VFPrint(stdout, format, args); | 165 VFPrint(stdout, format, args); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 void OS::Exit(int code) { | 244 void OS::Exit(int code) { |
| 245 exit(code); | 245 exit(code); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace dart | 248 } // namespace dart |
| 249 | 249 |
| 250 #endif // defined(TARGET_OS_MACOS) | 250 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |