From patchwork Mon Aug 4 23:31:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 24057 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 4E937BE086 for ; Mon, 4 Aug 2025 23:32:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 49B376921D; Tue, 5 Aug 2025 01:32:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IrEbYr9F"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0778D61466 for ; Tue, 5 Aug 2025 01:32:06 +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 6B25932FD for ; Tue, 5 Aug 2025 01:31:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754350278; bh=VcwlxHY9wgGPcAlPwYey7b0SZvcyKZeF4USULLlapZI=; h=From:To:Subject:Date:From; b=IrEbYr9FPwggc7dOPdIqWZBndUZzZQ3KmS0ILdj2Dj0mJN7ywq0IJs7AOA5MC1p1D yzUeTWvRe0kP8y34qAnQKQ4udJAoE9t/F8tZs6h8iJ2yYhDZHDAYCM+hskfBuP29qn mvLoTqWgbU4QWrDt5p//nw8TLaYcmGDakxpBGFns= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH v4 0/2] libcamera: Introduce and use scope_exit Date: Tue, 5 Aug 2025 02:31:49 +0300 Message-ID: <20250804233152.11538-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: 7a42f3c3d88926aa05b07d9c6a783bdbbfb73610 --- Regards, Laurent Pinchart