From b49d9e19dcfb78272be57a5938e2e37fe60502fb Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Tue, 26 Mar 2019 12:04:05 -0700 Subject: fastboot: Avoid extra std::string copies The function do_for_partitions() takes a const std::string reference, so it's inefficient to pass a std::string::c_str(). Test: TreeHugger Change-Id: Ia84ed9ec691ee2f524c61dd25a81b2995bb0bb33 --- fastboot/fastboot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fastboot') diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp index 4cdd8bcd9..827db9671 100644 --- a/fastboot/fastboot.cpp +++ b/fastboot/fastboot.cpp @@ -1805,7 +1805,7 @@ int FastBootTool::Main(int argc, char* argv[]) { auto format = [&](const std::string& partition) { fb_perform_format(partition, 0, type_override, size_override, ""); }; - do_for_partitions(partition.c_str(), slot_override, format, true); + do_for_partitions(partition, slot_override, format, true); } else if (command == "signature") { std::string filename = next_arg(&args); std::vector data; @@ -1876,7 +1876,7 @@ int FastBootTool::Main(int argc, char* argv[]) { } do_flash(partition.c_str(), fname.c_str()); }; - do_for_partitions(pname.c_str(), slot_override, flash, true); + do_for_partitions(pname, slot_override, flash, true); } else if (command == "flash:raw") { std::string partition = next_arg(&args); std::string kernel = next_arg(&args); -- cgit v1.2.3