From 51678ed08e5a99d077aed08ca4e9ff4be51e672a Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 27 Feb 2022 23:33:16 +0000 Subject: [PATCH] Removed unnecessary copying when generating raw buffers from EDBG AVR command frames. --- .../EDBG/AVR/CommandFrames/AvrCommandFrame.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp index 07c3668e..142849bd 100644 --- a/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp +++ b/src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/CommandFrames/AvrCommandFrame.hpp @@ -103,9 +103,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr * @return */ [[nodiscard]] auto getRawCommandFrame() const { - auto data = this->getPayload(); - const auto dataSize = data.size(); - auto rawCommand = std::vector(5); rawCommand[0] = this->SOF; @@ -116,11 +113,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr rawCommand[4] = static_cast(this->getProtocolHandlerId()); - if (dataSize > 0) { + if (!this->payload.empty()) { rawCommand.insert( rawCommand.end(), - data.begin(), - data.end() + this->payload.begin(), + this->payload.end() ); }