| Index: runtime/vm/json_stream.cc
|
| diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
|
| index df60bc52992e42f6acfe551d15959bbb36ab9b2d..045fced739376162c3f6017e002182b4a179a67f 100644
|
| --- a/runtime/vm/json_stream.cc
|
| +++ b/runtime/vm/json_stream.cc
|
| @@ -84,6 +84,23 @@ void JSONStream::PrintValue(const char* s) {
|
| }
|
|
|
|
|
| +void JSONStream::PrintfValue(const char* format, ...) {
|
| + PrintCommaIfNeeded();
|
| +
|
| + va_list args;
|
| + va_start(args, format);
|
| + intptr_t len = OS::VSNPrint(NULL, 0, format, args);
|
| + va_end(args);
|
| + char* p = reinterpret_cast<char*>(malloc(len+1));
|
| + va_start(args, format);
|
| + intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
|
| + va_end(args);
|
| + ASSERT(len == len2);
|
| + buffer_->Printf("\"%s\"", p);
|
| + free(p);
|
| +}
|
| +
|
| +
|
| void JSONStream::PrintValue(const Object& o, bool ref) {
|
| PrintCommaIfNeeded();
|
| o.PrintToJSONStream(this, ref);
|
| @@ -114,6 +131,22 @@ void JSONStream::PrintProperty(const char* name, const char* s) {
|
| }
|
|
|
|
|
| +void JSONStream::PrintfProperty(const char* name, const char* format, ...) {
|
| + PrintPropertyName(name);
|
| + va_list args;
|
| + va_start(args, format);
|
| + intptr_t len = OS::VSNPrint(NULL, 0, format, args);
|
| + va_end(args);
|
| + char* p = reinterpret_cast<char*>(malloc(len+1));
|
| + va_start(args, format);
|
| + intptr_t len2 = OS::VSNPrint(p, len+1, format, args);
|
| + va_end(args);
|
| + ASSERT(len == len2);
|
| + buffer_->Printf("\"%s\"", p);
|
| + free(p);
|
| +}
|
| +
|
| +
|
| void JSONStream::PrintProperty(const char* name, const Object& o, bool ref) {
|
| PrintPropertyName(name);
|
| PrintValue(o, ref);
|
|
|