mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 23:39:44 +03:00
libcamera: device_enumerator: Remove move() on search() return
Remove the std::move() call on the shared_ptr<MediaDevice *> returned by the search() method and remove the std::move() call on temporary return value in pipeline handlers that use the method. Thanks to copy elision, the regular constructor of the newly created object is called, avoiding un-necessary copies. Furthermore, the use of std::move() in the return and assignment statements prevents the compiler from performing copy elision, forcing it to generate two sequences of un-necessary calls to the class' move constructor and destructor. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
fea6dc9365
commit
ddcd8ebb3d
4 changed files with 5 additions and 5 deletions
|
@ -308,7 +308,7 @@ std::shared_ptr<MediaDevice> DeviceEnumerator::search(const DeviceMatch &dm)
|
||||||
LOG(DeviceEnumerator, Debug)
|
LOG(DeviceEnumerator, Debug)
|
||||||
<< "Successful match for media device \""
|
<< "Successful match for media device \""
|
||||||
<< media->driver() << "\"";
|
<< media->driver() << "\"";
|
||||||
return std::move(media);
|
return media;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,11 +278,11 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
|
||||||
imgu_dm.add("ipu3-imgu 1 viewfinder");
|
imgu_dm.add("ipu3-imgu 1 viewfinder");
|
||||||
imgu_dm.add("ipu3-imgu 1 3a stat");
|
imgu_dm.add("ipu3-imgu 1 3a stat");
|
||||||
|
|
||||||
cio2_ = std::move(enumerator->search(cio2_dm));
|
cio2_ = enumerator->search(cio2_dm);
|
||||||
if (!cio2_)
|
if (!cio2_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
imgu_ = std::move(enumerator->search(imgu_dm));
|
imgu_ = enumerator->search(imgu_dm);
|
||||||
if (!imgu_)
|
if (!imgu_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)
|
||||||
{
|
{
|
||||||
DeviceMatch dm("uvcvideo");
|
DeviceMatch dm("uvcvideo");
|
||||||
|
|
||||||
media_ = std::move(enumerator->search(dm));
|
media_ = enumerator->search(dm);
|
||||||
|
|
||||||
if (!media_)
|
if (!media_)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -148,7 +148,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
|
||||||
dm.add("RGB/YUV Input");
|
dm.add("RGB/YUV Input");
|
||||||
dm.add("Scaler");
|
dm.add("Scaler");
|
||||||
|
|
||||||
media_ = std::move(enumerator->search(dm));
|
media_ = enumerator->search(dm);
|
||||||
if (!media_)
|
if (!media_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue