Chromium Code Reviews| 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_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 | 9 |
| 10 #include <malloc.h> // NOLINT | 10 #include <malloc.h> // NOLINT |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 } | 252 } |
| 253 char* result = reinterpret_cast<char*>(malloc(len + 1)); | 253 char* result = reinterpret_cast<char*>(malloc(len + 1)); |
| 254 if (result == NULL) { | 254 if (result == NULL) { |
| 255 return NULL; | 255 return NULL; |
| 256 } | 256 } |
| 257 result[len] = '\0'; | 257 result[len] = '\0'; |
| 258 return reinterpret_cast<char*>(memmove(result, s, len)); | 258 return reinterpret_cast<char*>(memmove(result, s, len)); |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 intptr_t OS::StrNDup(const char* s, intptr_t n) { | |
|
zra
2016/05/17 19:39:27
StrNLen?
| |
| 263 return strnlen(s, n); | |
| 264 } | |
| 265 | |
| 266 | |
| 262 void OS::Print(const char* format, ...) { | 267 void OS::Print(const char* format, ...) { |
| 263 va_list args; | 268 va_list args; |
| 264 va_start(args, format); | 269 va_start(args, format); |
| 265 VFPrint(stdout, format, args); | 270 VFPrint(stdout, format, args); |
| 266 va_end(args); | 271 va_end(args); |
| 267 } | 272 } |
| 268 | 273 |
| 269 | 274 |
| 270 void OS::VFPrint(FILE* stream, const char* format, va_list args) { | 275 void OS::VFPrint(FILE* stream, const char* format, va_list args) { |
| 271 vfprintf(stream, format, args); | 276 vfprintf(stream, format, args); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 // TODO(zra): Remove once VM shuts down cleanly. | 424 // TODO(zra): Remove once VM shuts down cleanly. |
| 420 private_flag_windows_run_tls_destructors = false; | 425 private_flag_windows_run_tls_destructors = false; |
| 421 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 426 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| 422 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 427 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| 423 ::ExitProcess(code); | 428 ::ExitProcess(code); |
| 424 } | 429 } |
| 425 | 430 |
| 426 } // namespace dart | 431 } // namespace dart |
| 427 | 432 |
| 428 #endif // defined(TARGET_OS_WINDOWS) | 433 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |