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

Unified Diff: runtime/vm/debugger.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/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 96966d92ae1c690d3c5604c088c7a414dd6ea5cf..50aa858b36f59331feadd7828ba8d47b989887e3 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -403,17 +403,11 @@ const char* Debugger::QualifiedFunctionName(const Function& func) {
Class& func_class = Class::Handle(func.Owner());
String& class_name = String::Handle(func_class.Name());
- const char* kFormat = "%s%s%s";
- intptr_t len = OS::SNPrint(NULL, 0, kFormat,
- func_class.IsTopLevel() ? "" : class_name.ToCString(),
- func_class.IsTopLevel() ? "" : ".",
- func_name.ToCString());
- len++; // String terminator.
- char* chars = Thread::Current()->zone()->Alloc<char>(len);
- OS::SNPrint(chars, len, kFormat,
- func_class.IsTopLevel() ? "" : class_name.ToCString(),
- func_class.IsTopLevel() ? "" : ".",
- func_name.ToCString());
+ char* chars = NULL;
+ SNPRINT(chars, Thread::Current()->zone()->Alloc<char>, "%s%s%s",
+ func_class.IsTopLevel() ? "" : class_name.ToCString(),
+ func_class.IsTopLevel() ? "" : ".",
+ func_name.ToCString());
return chars;
}

Powered by Google App Engine
This is Rietveld 408576698