From ddcd8ebb3de0d5938b59eb62b9cf2e5bc430d820 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 12 Feb 2019 21:48:10 +0100 Subject: libcamera: device_enumerator: Remove move() on search() return MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the std::move() call on the shared_ptr 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 Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/device_enumerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libcamera/device_enumerator.cpp') diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index abbd0ef7..66819f07 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -308,7 +308,7 @@ std::shared_ptr DeviceEnumerator::search(const DeviceMatch &dm) LOG(DeviceEnumerator, Debug) << "Successful match for media device \"" << media->driver() << "\""; - return std::move(media); + return media; } } -- cgit v1.2.1