Browse Source

plutosdr: use move semantics in device scan

Transfer ownership of the temporary fixed URI into DeviceScan and the
newly created shared pointer into the scan list instead of copying them.
Neither object is used after the transfer, so moving avoids unnecessary
string and shared_ptr copies and makes the intended ownership transfer
explicit.

This fixes Coverity CIDs 652268 and 652358 (COPY_INSTEAD_OF_MOVE).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 4 months ago
parent
commit
74c8c66518
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 5
      devices/plutosdr/deviceplutosdrscan.cpp

5
devices/plutosdr/deviceplutosdrscan.cpp

@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
#include <memory>
#include <string_view>
#include <iio.h>
#include <utility>
#include <QtGlobal>
@ -82,9 +83,9 @@ void DevicePlutoSDRScan::scan() @@ -82,9 +83,9 @@ void DevicePlutoSDRScan::scan()
DeviceScan({
std::string(description),
std::string("TBD"),
fixedUri
std::move(fixedUri)
}));
m_scans.push_back(dev_scan);
m_scans.push_back(std::move(dev_scan));
m_urilMap[m_scans.back()->m_uri] = m_scans.back();
std::regex desc_regex(".*serial=(.+)");

Loading…
Cancel
Save