From patchwork Wed Jul 30 10:27:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 24036 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 C3FCFBDC71 for ; Wed, 30 Jul 2025 10:27:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8FBD691FF; Wed, 30 Jul 2025 12:27:46 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nF0IhDxt"; 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 AA8856914D for ; Wed, 30 Jul 2025 12:27:42 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 162FFA57 for ; Wed, 30 Jul 2025 12:26:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1753871219; bh=88blg7lqUA1I2CR+V4SNI/IE7yMzkmzDv+ljLhh8vK4=; h=From:To:Subject:Date:From; b=nF0IhDxtY7hVYnTp2Xdp6gNvMbeBELN2l+/PwZcb2NxYcAj4oEtryLRe/Qn/eyExn vziZRFyOVAgbXqs+hl4uw0a9/PeUu/+cLpRsXCpbuk/esX3tTJKgJX9QOiW3yAsQ4F CTbxUVt+L4QLGLyHKFJZ/T+rzNP2ttJnx1rPQqWs= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v3 0/2] libcamera: Introduce and use scope_exit Date: Wed, 30 Jul 2025 13:27:31 +0300 Message-ID: <20250730102733.21314-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.1 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" Hello, libcamera includes a ScopeExitActions class that simplifies error handling by gathering cleanup actions for automatic run on scope exit. The mechanism is quite versatile, but is not suitable for hot paths as it requires dynamic heap allocation. This series introduces in patch 1/2 a new simpler scope_exit class that implements the API defined in the C++ library fundamentals TS v3. It does not suffer from the same issue as ScopeExitActions, but is less versatile as a result. Patch 2/2 then uses the new class in V4L2VideoDevice::queueBuffer() to simplify error handling. Laurent Pinchart (2): libcamera: utils: Add scope_exit class libcamera: v4l2_videodevice: Use scope_exit include/libcamera/base/utils.h | 38 ++++++++++++++++++++++++++++++ src/libcamera/v4l2_videodevice.cpp | 11 +++------ 2 files changed, 41 insertions(+), 8 deletions(-) base-commit: 2d5a1367e2b14dab9671270655bbb1702e0826de --- Regards, Laurent Pinchart