1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-10 21:43:31 -04:00

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>
This commit is contained in:
Robin Getz
2026-08-07 19:37:21 -04:00
parent 6d786dec7c
commit 74c8c66518
+3 -2
View File
@@ -24,6 +24,7 @@
#include <memory>
#include <string_view>
#include <iio.h>
#include <utility>
#include <QtGlobal>
@@ -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=(.+)");