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

Unified Diff: vm/object.cc

Issue 10933021: - Do not limit the compiler message buffer, by allocating the message (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « vm/object.h ('k') | vm/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.cc
===================================================================
--- vm/object.cc (revision 12163)
+++ vm/object.cc (working copy)
@@ -9500,15 +9500,22 @@
RawString* String::NewFormatted(const char* format, ...) {
va_list args;
va_start(args, format);
- intptr_t len = OS::VSNPrint(NULL, 0, format, args);
+ RawString* result = NewFormattedV(format, args);
+ NoGCScope no_gc;
va_end(args);
+ return result;
+}
+
+RawString* String::NewFormattedV(const char* format, va_list args) {
+ va_list args_copy;
+ va_copy(args_copy, args);
hausner 2012/09/11 16:11:14 I am not familiar with va_copy. Is va_start no lon
Ivan Posva 2012/09/11 16:14:39 va_copy creates a copy of the passed in va_list ar
+ intptr_t len = OS::VSNPrint(NULL, 0, format, args_copy);
+ va_end(args_copy);
+
Zone* zone = Isolate::Current()->current_zone();
char* buffer = zone->Alloc<char>(len + 1);
- va_list args2;
- va_start(args2, format);
- OS::VSNPrint(buffer, (len + 1), format, args2);
- va_end(args2);
+ OS::VSNPrint(buffer, (len + 1), format, args);
return String::New(buffer);
}
« no previous file with comments | « vm/object.h ('k') | vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698