| 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/os.h" | 5 #include "vm/os.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <mach/mach.h> | 9 #include <mach/mach.h> |
| 10 #include <mach/clock.h> | 10 #include <mach/clock.h> |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 int OS::SNPrint(char* str, size_t size, const char* format, ...) { | 121 int OS::SNPrint(char* str, size_t size, const char* format, ...) { |
| 122 va_list args; | 122 va_list args; |
| 123 va_start(args, format); | 123 va_start(args, format); |
| 124 int retval = VSNPrint(str, size, format, args); | 124 int retval = VSNPrint(str, size, format, args); |
| 125 va_end(args); | 125 va_end(args); |
| 126 return retval; | 126 return retval; |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { | 130 int OS::VSNPrint(char* str, size_t size, const char* format, va_list args) { |
| 131 return vsnprintf(str, size, format, args); | 131 int retval = vsnprintf(str, size, format, args); |
| 132 if (retval < 0) { |
| 133 FATAL1("Fatal error in OS::VSNPrint with format '%s'", format); |
| 134 } |
| 135 return retval; |
| 132 } | 136 } |
| 133 | 137 |
| 134 | 138 |
| 135 void OS::PrintErr(const char* format, ...) { | 139 void OS::PrintErr(const char* format, ...) { |
| 136 va_list args; | 140 va_list args; |
| 137 va_start(args, format); | 141 va_start(args, format); |
| 138 VFPrint(stderr, format, args); | 142 VFPrint(stderr, format, args); |
| 139 va_end(args); | 143 va_end(args); |
| 140 } | 144 } |
| 141 | 145 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 157 void OS::Abort() { | 161 void OS::Abort() { |
| 158 abort(); | 162 abort(); |
| 159 } | 163 } |
| 160 | 164 |
| 161 | 165 |
| 162 void OS::Exit(int code) { | 166 void OS::Exit(int code) { |
| 163 exit(code); | 167 exit(code); |
| 164 } | 168 } |
| 165 | 169 |
| 166 } // namespace dart | 170 } // namespace dart |
| OLD | NEW |