From patchwork Wed Jan 2 11:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 131 Return-Path: Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 804DF60B34 for ; Wed, 2 Jan 2019 12:00:20 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 22EBB6000C; Wed, 2 Jan 2019 11:00:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 2 Jan 2019 12:00:16 +0100 Message-Id: <20190102110016.5489-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190102110016.5489-1-jacopo@jmondi.org> References: <20190102110016.5489-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: media_device: Make getEntityByName() const X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2019 11:00:20 -0000 The function does not modify the instance state. Mark it as const. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/include/media_device.h | 2 +- src/libcamera/media_device.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h index d787be3..9db18bb 100644 --- a/src/libcamera/include/media_device.h +++ b/src/libcamera/include/media_device.h @@ -34,7 +34,7 @@ public: const std::string devnode() const { return devnode_; } const std::vector &entities() const { return entities_; } - MediaEntity *getEntityByName(const std::string &name); + MediaEntity *getEntityByName(const std::string &name) const; private: std::string driver_; diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp index 9fbc5a7..25d1825 100644 --- a/src/libcamera/media_device.cpp +++ b/src/libcamera/media_device.cpp @@ -244,7 +244,7 @@ int MediaDevice::populate() * \return The entity with \a name * \return nullptr if no entity with \a name is found */ -MediaEntity *MediaDevice::getEntityByName(const std::string &name) +MediaEntity *MediaDevice::getEntityByName(const std::string &name) const { for (MediaEntity *e : entities_) if (e->name() == name)