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/zone.h" | 5 #include "vm/zone.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/handles_impl.h" | 10 #include "vm/handles_impl.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 while (zone != NULL) { | 196 while (zone != NULL) { |
197 zone->handles()->VisitObjectPointers(visitor); | 197 zone->handles()->VisitObjectPointers(visitor); |
198 zone = zone->previous_; | 198 zone = zone->previous_; |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 | 202 |
203 char* Zone::PrintToString(const char* format, ...) { | 203 char* Zone::PrintToString(const char* format, ...) { |
204 va_list args; | 204 va_list args; |
205 va_start(args, format); | 205 va_start(args, format); |
206 intptr_t len = OS::VSNPrint(NULL, 0, format, args); | 206 return VPrint(format, args); |
207 va_end(args); | 207 } |
208 | 208 |
| 209 |
| 210 char* Zone::VPrint(const char* format, va_list args) { |
| 211 // Measure. |
| 212 va_list measure_args; |
| 213 va_copy(measure_args, args); |
| 214 intptr_t len = OS::VSNPrint(NULL, 0, format, measure_args); |
| 215 va_end(measure_args); |
| 216 |
| 217 // Print. |
209 char* buffer = Alloc<char>(len + 1); | 218 char* buffer = Alloc<char>(len + 1); |
210 va_list args2; | 219 va_list print_args; |
211 va_start(args2, format); | 220 va_copy(print_args, args); |
212 OS::VSNPrint(buffer, (len + 1), format, args2); | 221 OS::VSNPrint(buffer, (len + 1), format, print_args); |
213 va_end(args2); | 222 va_end(print_args); |
214 | |
215 return buffer; | 223 return buffer; |
216 } | 224 } |
217 | 225 |
| 226 |
218 } // namespace dart | 227 } // namespace dart |
OLD | NEW |