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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/zone.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone.cc
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
index c271991a33c17b1a73cee4f36e94bc3912cf12a8..ea42f49055c2d6ce6d447feff7ec3b315a334cc7 100644
--- a/runtime/vm/zone.cc
+++ b/runtime/vm/zone.cc
@@ -203,24 +203,14 @@ void Zone::VisitObjectPointers(ObjectPointerVisitor* visitor) {
char* Zone::PrintToString(const char* format, ...) {
va_list args;
va_start(args, format);
- return VPrint(format, args);
+ char* buffer = OS::VSCreate(this, format, args);
+ va_end(args);
+ return buffer;
}
char* Zone::VPrint(const char* format, va_list args) {
- // Measure.
- va_list measure_args;
- va_copy(measure_args, args);
- intptr_t len = OS::VSNPrint(NULL, 0, format, measure_args);
- va_end(measure_args);
-
- // Print.
- char* buffer = Alloc<char>(len + 1);
- va_list print_args;
- va_copy(print_args, args);
- OS::VSNPrint(buffer, (len + 1), format, print_args);
- va_end(print_args);
- return buffer;
+ return OS::VSCreate(this, format, args);
}
« 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