Show a patch.

GET /api/patches/26541/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26541,
    "url": "https://patchwork.libcamera.org/api/patches/26541/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26541/",
    "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": "<20260423230059.3180987-20-laurent.pinchart@ideasonboard.com>",
    "date": "2026-04-23T23:00:41",
    "name": "[v3,19/37] libcamera: value_node: Support looking up descendant node by path",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "72ddd8d841b7831e07056199c1e17a53cb125575",
    "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/26541/mbox/",
    "series": [
        {
            "id": 5883,
            "url": "https://patchwork.libcamera.org/api/series/5883/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5883",
            "date": "2026-04-23T23:00:22",
            "name": "libcamera: Global configuration file improvements",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5883/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26541/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26541/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 6AD58BDCB5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Apr 2026 23:01:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2159E62FBC;\n\tFri, 24 Apr 2026 01:01:43 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F2DF062FA2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Apr 2026 01:01:27 +0200 (CEST)",
            "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 ESMTPSA id 7E4819A6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Apr 2026 00:59:48 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hdhWFbCs\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1776985188;\n\tbh=jYA4ZrmdMuN4fMJyT8ozMO+KYOftW5mwSAAbsLE8jcw=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=hdhWFbCsX4W34PtnAo+x+v5RCyuZ97R92Gg9IbUoESiH0YsXl1UYgWrWGh8I3CXTz\n\t34zRjwRdyiZ3tlbEn6GQCjeA16VN30yRcFpXhSEXv8GhxHoSXewfeHTAVvdpNAEMSv\n\tg9VJxy60EQxas3DzV2GXMR5ojgLDYe1gTywl2ClU=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v3 19/37] libcamera: value_node: Support looking up\n\tdescendant node by path",
        "Date": "Fri, 24 Apr 2026 02:00:41 +0300",
        "Message-ID": "<20260423230059.3180987-20-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260423230059.3180987-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20260423230059.3180987-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "Looking up a descendant node based on a path is a common operation. Add\na helper function to do so, to avoid loops in the callers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>\n---\nChanges since v1:\n\n- Use reference in range-based for loop\n- Improve commit message\n---\n include/libcamera/internal/value_node.h |  1 +\n src/libcamera/value_node.cpp            | 23 +++++++++++++++++++++++\n 2 files changed, 24 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h\nindex 578413199df1..ccae69e25a82 100644\n--- a/include/libcamera/internal/value_node.h\n+++ b/include/libcamera/internal/value_node.h\n@@ -237,6 +237,7 @@ public:\n \tbool contains(std::string_view key) const;\n \tValueNode *at(std::string_view key);\n \tconst ValueNode &operator[](std::string_view key) const;\n+\tconst ValueNode &operator[](std::initializer_list<std::string_view> path) const;\n \n \tValueNode *add(std::unique_ptr<ValueNode> &&child);\n \tValueNode *add(std::string key, std::unique_ptr<ValueNode> &&child);\ndiff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp\nindex 3b4041b7bbf0..6ab11009fccc 100644\n--- a/src/libcamera/value_node.cpp\n+++ b/src/libcamera/value_node.cpp\n@@ -488,6 +488,29 @@ const ValueNode &ValueNode::operator[](std::string_view key) const\n \treturn *iter->second;\n }\n \n+/**\n+ * \\brief Retrieve a descendant node by path\n+ * \\param[in] path The path\n+ *\n+ * This function retrieves a descendant of a ValueNode by following a \\a path.\n+ * The path is a list of keys that index nested dictionary nodes. If any node\n+ * along the path is not a Dictionary node, an empty node is returned.\n+ *\n+ * \\return The ValueNode corresponding to the \\a path\n+ */\n+const ValueNode &ValueNode::operator[](std::initializer_list<std::string_view> path) const\n+{\n+\tconst ValueNode *node = this;\n+\n+\tfor (const auto &part : path) {\n+\t\tnode = &(*node)[part];\n+\t\tif (!*node)\n+\t\t\treturn empty;\n+\t}\n+\n+\treturn *node;\n+}\n+\n /**\n  * \\brief Add a child node to a list\n  * \\param[in] child The child node\n",
    "prefixes": [
        "v3",
        "19/37"
    ]
}