Patch Detail
Show a patch.
GET /api/patches/26135/?format=api
{ "id": 26135, "url": "https://patchwork.libcamera.org/api/patches/26135/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26135/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260212123555.2686756-1-laurent.pinchart@ideasonboard.com>", "date": "2026-02-12T12:35:55", "name": "libcamera: Replace iterators with structured bindings", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "7b10190804da05feb755179eec8d025efe25bec8", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26135/mbox/", "series": [ { "id": 5786, "url": "https://patchwork.libcamera.org/api/series/5786/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5786", "date": "2026-02-12T12:35:55", "name": "libcamera: Replace iterators with structured bindings", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5786/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26135/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26135/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 68B28BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Feb 2026 12:36:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7AA08621C7;\n\tThu, 12 Feb 2026 13:35:59 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A997F61FBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Feb 2026 13:35:57 +0100 (CET)", "from killaraus.ideasonboard.com\n\t(2001-14ba-703d-e500--2a1.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::2a1])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 74F30E70\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Feb 2026 13:35:09 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pSjpn/nA\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1770899709;\n\tbh=OdhrwbxcTqjN3k+r0/4HQcjId+0GxsTiG/JQLs/VWIg=;\n\th=From:To:Subject:Date:From;\n\tb=pSjpn/nAdjmly/NJWG1Pe5rXz3qh9xJjCj7OAs8P46xod2JpNE41GYkodZ7fBiNFR\n\tLGCBqj4BV9mdSmUMMVZpRylxgeWI4GPT7QcdpOQZkBKQPhIA3FkPPDfyHa2ReRj4MN\n\txUNTdTPFWoUwJ1Vc6WGViGPYwWmfAwc9QPN0+ZeM=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH] libcamera: Replace iterators with structured bindings", "Date": "Thu, 12 Feb 2026 14:35:55 +0200", "Message-ID": "<20260212123555.2686756-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.52.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Use structured bindings when iterating over a map in range-based for\nloops. This improves readability.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/ipu3/ipu3.cpp | 11 +++--------\n src/libcamera/pipeline/vimc/vimc.cpp | 3 +--\n src/libcamera/v4l2_videodevice.cpp | 6 ++----\n 3 files changed, 6 insertions(+), 14 deletions(-)\n\n\nbase-commit: 1dcf9957a47fb54fce4fbae9daec0b587e52562e", "diff": "diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 0190f677e679..d1d4d85ebe76 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -791,8 +791,7 @@ void IPU3CameraData::cancelPendingRequests()\n \twhile (!pendingRequests_.empty()) {\n \t\tRequest *request = pendingRequests_.front();\n \n-\t\tfor (auto it : request->buffers()) {\n-\t\t\tFrameBuffer *buffer = it.second;\n+\t\tfor (auto [stream, buffer] : request->buffers()) {\n \t\t\tbuffer->_d()->cancel();\n \t\t\tpipe()->completeBuffer(request, buffer);\n \t\t}\n@@ -1225,10 +1224,7 @@ void IPU3CameraData::paramsComputed(unsigned int id)\n \t\treturn;\n \n \t/* Queue all buffers from the request aimed for the ImgU. */\n-\tfor (auto it : info->request->buffers()) {\n-\t\tconst Stream *stream = it.first;\n-\t\tFrameBuffer *outbuffer = it.second;\n-\n+\tfor (auto [stream, outbuffer] : info->request->buffers()) {\n \t\tif (stream == &outStream_)\n \t\t\timgu_->output_->queueBuffer(outbuffer);\n \t\telse if (stream == &vfStream_)\n@@ -1304,8 +1300,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n \n \t/* If the buffer is cancelled force a complete of the whole request. */\n \tif (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n-\t\tfor (auto it : request->buffers()) {\n-\t\t\tFrameBuffer *b = it.second;\n+\t\tfor (auto [stream, b] : request->buffers()) {\n \t\t\tb->_d()->cancel();\n \t\t\tpipe()->completeBuffer(request, b);\n \t\t}\ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex 4a03c149a617..025e7dbdd26f 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -607,8 +607,7 @@ void VimcCameraData::imageBufferReady(FrameBuffer *buffer)\n \n \t/* If the buffer is cancelled force a complete of the whole request. */\n \tif (buffer->metadata().status == FrameMetadata::FrameCancelled) {\n-\t\tfor (auto it : request->buffers()) {\n-\t\t\tFrameBuffer *b = it.second;\n+\t\tfor (auto [stream, b] : request->buffers()) {\n \t\t\tb->_d()->cancel();\n \t\t\tpipe->completeBuffer(request, b);\n \t\t}\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 25b61d049a0e..02c50886a084 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -2042,10 +2042,8 @@ int V4L2VideoDevice::streamOff()\n \tstate_ = State::Stopping;\n \n \t/* Send back all queued buffers. */\n-\tfor (auto it : queuedBuffers_) {\n-\t\tFrameBuffer *buffer = it.second;\n-\n-\t\tcache_->put(it.first);\n+\tfor (auto [id, buffer] : queuedBuffers_) {\n+\t\tcache_->put(id);\n \t\tbuffer->_d()->cancel();\n \t\tbufferReady.emit(buffer);\n \t}\n", "prefixes": [] }