Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: runtime/vm/zone.cc

Issue 1331623002: Uses SNPRINT macro where possible. Otherwise uses #define for format. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add missing include Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/zone.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 return VPrint(format, args); 206 char* buffer = OS::VSCreate(this, format, args);
207 va_end(args);
208 return buffer;
207 } 209 }
208 210
209 211
210 char* Zone::VPrint(const char* format, va_list args) { 212 char* Zone::VPrint(const char* format, va_list args) {
211 // Measure. 213 return OS::VSCreate(this, format, args);
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.
218 char* buffer = Alloc<char>(len + 1);
219 va_list print_args;
220 va_copy(print_args, args);
221 OS::VSNPrint(buffer, (len + 1), format, print_args);
222 va_end(print_args);
223 return buffer;
224 } 214 }
225 215
226 216
227 } // namespace dart 217 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/zone.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698