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

Unified Diff: runtime/vm/isolate.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/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 06dfad2153440b67c04ff43cdeaa55d35a78a82e..bbda77fd3555578c92be46b175143c4b1fa5cc01 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -900,10 +900,7 @@ void Isolate::BuildName(const char* name_prefix) {
name_ = strdup(name_prefix);
return;
}
- const char* kFormat = "%s-%lld";
- intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1;
- name_ = reinterpret_cast<char*>(malloc(len));
- OS::SNPrint(name_, len, kFormat, name_prefix, main_port());
+ SNPRINT(name_, malloc, "%s-%lld", name_prefix, main_port());
}

Powered by Google App Engine
This is Rietveld 408576698