summaryrefslogtreecommitdiffstats
path: root/fastboot
diff options
context:
space:
mode:
authorGreg Kaiser <gkaiser@google.com>2019-03-26 12:04:05 -0700
committerGreg Kaiser <gkaiser@google.com>2019-03-26 12:04:05 -0700
commitb49d9e19dcfb78272be57a5938e2e37fe60502fb (patch)
treea4d1dd4cff9f02205d43bc7c86fd7e4527284b71 /fastboot
parente2125fdeb1f72f5599853f82fc7ed2be9d5ee015 (diff)
downloadsystem_core-b49d9e19dcfb78272be57a5938e2e37fe60502fb.tar.gz
system_core-b49d9e19dcfb78272be57a5938e2e37fe60502fb.tar.bz2
system_core-b49d9e19dcfb78272be57a5938e2e37fe60502fb.zip
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
Diffstat (limited to 'fastboot')
-rw-r--r--fastboot/fastboot.cpp4
1 files changed, 2 insertions, 2 deletions
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<char> 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);