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

Unified Diff: runtime/vm/timeline.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: 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
Index: runtime/vm/timeline.cc
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index ecdd085124b9e29788d0b591c5ed7b623dd22022..57566c6647de37a473837f2faa650bcc9005bdcf 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -441,11 +441,9 @@ void TimelineEventRecorder::WriteTo(const char* directory) {
TimelineEventFilter filter;
PrintJSON(&js, &filter);
- const char* format = "%s/dart-timeline-%" Pd ".json";
intptr_t pid = OS::ProcessId();
- intptr_t len = OS::SNPrint(NULL, 0, format, directory, pid);
- char* filename = reinterpret_cast<char*>(malloc(len + 1));
- OS::SNPrint(filename, len + 1, format, directory, pid);
+ char* filename = NULL;
+ SNPRINT(filename, malloc, "%s/dart-timeline-%" Pd ".json", directory, pid);
void* file = (*file_open)(filename, true);
if (file == NULL) {
OS::Print("Failed to write timeline file: %s\n", filename);

Powered by Google App Engine
This is Rietveld 408576698