Message ID | 20210322220910.3179457-1-hiroh@chromium.org |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Hi Hiro, Thank you for the patch. On Tue, Mar 23, 2021 at 07:09:10AM +0900, Hirokazu Honda wrote: > There are std::unique_ptr rvalue reference arguments. They are > intended to pass the ownership to the functions. In the case, > it is right to let the argument be std::unique_ptr value and > pass by std::move(). > > Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > include/libcamera/internal/device_enumerator.h | 2 +- > include/libcamera/internal/device_enumerator_udev.h | 4 ++-- > src/libcamera/device_enumerator.cpp | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h > index a9850400..707cfe8f 100644 > --- a/include/libcamera/internal/device_enumerator.h > +++ b/include/libcamera/internal/device_enumerator.h > @@ -49,7 +49,7 @@ public: > > protected: > std::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode); > - void addDevice(std::unique_ptr<MediaDevice> &&media); > + void addDevice(std::unique_ptr<MediaDevice> media); > void removeDevice(const std::string &deviceNode); > > private: > diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h > index 6f45be0c..58e64a29 100644 > --- a/include/libcamera/internal/device_enumerator_udev.h > +++ b/include/libcamera/internal/device_enumerator_udev.h > @@ -39,8 +39,8 @@ private: > using DependencyMap = std::map<dev_t, std::list<MediaEntity *>>; > > struct MediaDeviceDeps { > - MediaDeviceDeps(std::unique_ptr<MediaDevice> &&media, > - DependencyMap &&deps) > + MediaDeviceDeps(std::unique_ptr<MediaDevice> media, > + DependencyMap deps) > : media_(std::move(media)), deps_(std::move(deps)) > { > } > diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp > index 647974b1..e6ecc360 100644 > --- a/src/libcamera/device_enumerator.cpp > +++ b/src/libcamera/device_enumerator.cpp > @@ -246,7 +246,7 @@ std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &d > * This method shall be called after all members of the entities of the > * media graph have been confirmed to be initialized. > */ > -void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> &&media) > +void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> media) > { > LOG(DeviceEnumerator, Debug) > << "Added device " << media->deviceNode() << ": " << media->driver();
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h index a9850400..707cfe8f 100644 --- a/include/libcamera/internal/device_enumerator.h +++ b/include/libcamera/internal/device_enumerator.h @@ -49,7 +49,7 @@ public: protected: std::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode); - void addDevice(std::unique_ptr<MediaDevice> &&media); + void addDevice(std::unique_ptr<MediaDevice> media); void removeDevice(const std::string &deviceNode); private: diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h index 6f45be0c..58e64a29 100644 --- a/include/libcamera/internal/device_enumerator_udev.h +++ b/include/libcamera/internal/device_enumerator_udev.h @@ -39,8 +39,8 @@ private: using DependencyMap = std::map<dev_t, std::list<MediaEntity *>>; struct MediaDeviceDeps { - MediaDeviceDeps(std::unique_ptr<MediaDevice> &&media, - DependencyMap &&deps) + MediaDeviceDeps(std::unique_ptr<MediaDevice> media, + DependencyMap deps) : media_(std::move(media)), deps_(std::move(deps)) { } diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp index 647974b1..e6ecc360 100644 --- a/src/libcamera/device_enumerator.cpp +++ b/src/libcamera/device_enumerator.cpp @@ -246,7 +246,7 @@ std::unique_ptr<MediaDevice> DeviceEnumerator::createDevice(const std::string &d * This method shall be called after all members of the entities of the * media graph have been confirmed to be initialized. */ -void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> &&media) +void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> media) { LOG(DeviceEnumerator, Debug) << "Added device " << media->deviceNode() << ": " << media->driver();
There are std::unique_ptr rvalue reference arguments. They are intended to pass the ownership to the functions. In the case, it is right to let the argument be std::unique_ptr value and pass by std::move(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> --- include/libcamera/internal/device_enumerator.h | 2 +- include/libcamera/internal/device_enumerator_udev.h | 4 ++-- src/libcamera/device_enumerator.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) -- 2.31.0.rc2.261.g7f71774620-goog