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

Unified Diff: runtime/vm/coverage.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/coverage.cc
diff --git a/runtime/vm/coverage.cc b/runtime/vm/coverage.cc
index d18ce19b9d0294e9617b9a0832aa464b8cc9dd72..fcfaeabcac225a9dedee45ddfd9ecb02fb6af844 100644
--- a/runtime/vm/coverage.cc
+++ b/runtime/vm/coverage.cc
@@ -247,13 +247,11 @@ void CodeCoverage::Write(Isolate* isolate) {
JSONStream stream;
PrintJSON(isolate, &stream, NULL, false);
- const char* format = "%s/dart-cov-%" Pd "-%" Pd64 ".json";
+ char* filename = NULL;
intptr_t pid = OS::ProcessId();
- intptr_t len = OS::SNPrint(NULL, 0, format,
- FLAG_coverage_dir, pid, isolate->main_port());
- char* filename = Thread::Current()->zone()->Alloc<char>(len + 1);
- OS::SNPrint(filename, len + 1, format,
- FLAG_coverage_dir, pid, isolate->main_port());
+ SNPRINT(filename, Thread::Current()->zone()->Alloc<char>,
+ "%s/dart-cov-%" Pd "-%" Pd64 ".json",
+ FLAG_coverage_dir, pid, isolate->main_port());
void* file = (*file_open)(filename, true);
if (file == NULL) {
OS::Print("Failed to write coverage file: %s\n", filename);

Powered by Google App Engine
This is Rietveld 408576698