Removed unnecessary copying when generating raw buffers from EDBG AVR command frames.

This commit is contained in:
Nav
2022-02-27 23:33:16 +00:00
parent 8b6ee9f100
commit 51678ed08e

View File

@@ -103,9 +103,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
* @return * @return
*/ */
[[nodiscard]] auto getRawCommandFrame() const { [[nodiscard]] auto getRawCommandFrame() const {
auto data = this->getPayload();
const auto dataSize = data.size();
auto rawCommand = std::vector<unsigned char>(5); auto rawCommand = std::vector<unsigned char>(5);
rawCommand[0] = this->SOF; rawCommand[0] = this->SOF;
@@ -116,11 +113,11 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr
rawCommand[4] = static_cast<unsigned char>(this->getProtocolHandlerId()); rawCommand[4] = static_cast<unsigned char>(this->getProtocolHandlerId());
if (dataSize > 0) { if (!this->payload.empty()) {
rawCommand.insert( rawCommand.insert(
rawCommand.end(), rawCommand.end(),
data.begin(), this->payload.begin(),
data.end() this->payload.end()
); );
} }