From patchwork Mon Mar 31 15:06:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23083 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 077E5C323E for ; Mon, 31 Mar 2025 15:06:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3E8B76897A; Mon, 31 Mar 2025 17:06:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BxSyzOIJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BA05168967 for ; Mon, 31 Mar 2025 17:06:15 +0200 (CEST) Received: from pb-laptop.local (185.221.143.221.nat.pool.zt.hu [185.221.143.221]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21D6A703 for ; Mon, 31 Mar 2025 17:04:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743433464; bh=ZxE6z/Du8SoyIDGD3RnoWmpTOgez2vc4+2uDPJ1hngM=; h=From:To:Subject:Date:From; b=BxSyzOIJv5XvG6eYgMMWBqF7/wWcV3wV6Da56JvSy1JF5WzXZaUqUjo4MGfo7+PU8 rORw2hVpphCZDkHhOHbBlYWEN056kCq9jY6/EVFvHNHYUuZKMXpxWQx1/NPFSJHqpk J/nf0JoE9tU7rZ2zrJVPclfQX9kmaDgUAoVonU5w= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] libcamera: camera_manager: Simplify camera lookup Date: Mon, 31 Mar 2025 17:06:11 +0200 Message-ID: <20250331150611.523218-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" `std::find()` works just fine because `std::shared_ptr` has `operator==()` with the expected semantics. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/camera_manager.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 400109f12..b28bd0bd2 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -239,10 +239,7 @@ void CameraManager::Private::removeCamera(std::shared_ptr camera) { MutexLocker locker(mutex_); - auto iter = std::find_if(cameras_.begin(), cameras_.end(), - [camera](std::shared_ptr &c) { - return c.get() == camera.get(); - }); + auto iter = std::find(cameras_.begin(), cameras_.end(), camera); if (iter == cameras_.end()) return;