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

Unified Diff: runtime/vm/version_in.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
« runtime/vm/assembler.cc ('K') | « runtime/vm/timeline.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/version_in.cc
diff --git a/runtime/vm/version_in.cc b/runtime/vm/version_in.cc
index 34d7fc6763701db67c3e3ce3b5f0b7b443751623..c947c6d160082fa30013e2b8a670252b6a7843e8 100644
--- a/runtime/vm/version_in.cc
+++ b/runtime/vm/version_in.cc
@@ -14,13 +14,11 @@ static const char* formatted_version = NULL;
const char* Version::String() {
if (formatted_version == NULL) {
- const char* format = "%s on \"%s_%s\"";
const char* os = OS::Name();
const char* arch = CPU::Id();
- intptr_t len = OS::SNPrint(NULL, 0, format, str_, os, arch);
- char* buffer = reinterpret_cast<char*>(malloc(len + 1));
- OS::SNPrint(buffer, (len + 1), format, str_, os, arch);
+ char* buffer = NULL;
+ SNPRINT(buffer, malloc, "%s on \"%s_%s\"", str_, os, arch);
formatted_version = buffer;
}
return formatted_version;
« runtime/vm/assembler.cc ('K') | « runtime/vm/timeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698