libcamera: base: shared_fd: Add comparison operators

Add == and != comparison operators between two SharedFD instances, and
use them to replace manuel get() calls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Laurent Pinchart
2021-11-29 21:01:55 +02:00
parent 560f5cf998
commit f8d2f17a3d
3 changed files with 37 additions and 1 deletions
+10
View File
@@ -46,4 +46,14 @@ private:
std::shared_ptr<Descriptor> fd_;
};
static inline bool operator==(const SharedFD &lhs, const SharedFD &rhs)
{
return lhs.get() == rhs.get();
}
static inline bool operator!=(const SharedFD &lhs, const SharedFD &rhs)
{
return !(lhs == rhs);
}
} /* namespace libcamera */