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

Unified Diff: runtime/vm/snapshot.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/os_win.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index b336512c34e069296cf0a687f84b6510a9bf6772..85099cca5c331ac19b8e367b8c48f82a4de8efe0 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -2515,13 +2515,10 @@ RawFunction* SnapshotWriter::IsSerializableClosure(RawClass* cls,
ASSERT(!errorFunc.IsNull());
// All other closures are errors.
- const char* format = "Illegal argument in isolate message"
- " : (object is a closure - %s %s)";
UnmarkAll(); // Unmark objects now as we are about to print stuff.
- intptr_t len = OS::SNPrint(NULL, 0, format,
- clazz.ToCString(), errorFunc.ToCString()) + 1;
- char* chars = thread()->zone()->Alloc<char>(len);
- OS::SNPrint(chars, len, format, clazz.ToCString(), errorFunc.ToCString());
+ char* chars = OS::SCreate(thread()->zone(),
+ "Illegal argument in isolate message : (object is a closure - %s %s)",
+ clazz.ToCString(), errorFunc.ToCString());
SetWriteException(Exceptions::kArgument, chars);
}
return Function::null();
@@ -2544,13 +2541,12 @@ void SnapshotWriter::CheckForNativeFields(RawClass* cls) {
if (cls->ptr()->num_native_fields_ != 0) {
// We do not allow objects with native fields in an isolate message.
HANDLESCOPE(thread());
- const char* format = "Illegal argument in isolate message"
- " : (object extends NativeWrapper - %s)";
UnmarkAll(); // Unmark objects now as we are about to print stuff.
const Class& clazz = Class::Handle(isolate(), cls);
- intptr_t len = OS::SNPrint(NULL, 0, format, clazz.ToCString()) + 1;
- char* chars = thread()->zone()->Alloc<char>(len);
- OS::SNPrint(chars, len, format, clazz.ToCString());
+ char* chars = OS::SCreate(thread()->zone(),
+ "Illegal argument in isolate message"
+ " : (object extends NativeWrapper - %s)",
+ clazz.ToCString());
SetWriteException(Exceptions::kArgument, chars);
}
}
« no previous file with comments | « runtime/vm/os_win.cc ('k') | runtime/vm/stack_frame_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698