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:
@@ -214,6 +214,32 @@ SharedFD &SharedFD::operator=(SharedFD &&other)
|
||||
* instance is invalid
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bool operator==(const SharedFD &lhs, const SharedFD &rhs)
|
||||
* \brief Compare the owned file descriptors of two SharedFD for equality
|
||||
* \param[in] lhs The first SharedFD
|
||||
* \param[in] rhs The second SharedFD
|
||||
*
|
||||
* Two file descriptors are considered equal if they have the same numerical
|
||||
* value. File descriptors with different values that both reference the same
|
||||
* file (for instance obtained using dup()) are considered not equal.
|
||||
*
|
||||
* \return True if the two file descriptors are equal, false otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* \fn bool operator!=(const SharedFD &lhs, const SharedFD &rhs)
|
||||
* \brief Compare the owned file descriptors of two SharedFD for equality
|
||||
* \param[in] lhs The first SharedFD
|
||||
* \param[in] rhs The second SharedFD
|
||||
*
|
||||
* Two file descriptors are considered equal if they have the same numerical
|
||||
* value. File descriptors with different values that both reference the same
|
||||
* file (for instance obtained using dup()) are considered not equal.
|
||||
*
|
||||
* \return True if the two file descriptors are not equal, false otherwise
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Duplicate a SharedFD
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user