Show a patch.

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

{
    "id": 26465,
    "url": "https://patchwork.libcamera.org/api/patches/26465/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26465/",
    "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": "<20260407153427.1825999-26-laurent.pinchart@ideasonboard.com>",
    "date": "2026-04-07T15:34:10",
    "name": "[v2,25/42] libcamera: value_node: Support looking up descendant node by path",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "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/26465/mbox/",
    "series": [
        {
            "id": 5873,
            "url": "https://patchwork.libcamera.org/api/series/5873/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5873",
            "date": "2026-04-07T15:33:45",
            "name": "libcamera: Global configuration file improvements",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5873/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26465/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26465/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 8F36EC330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Apr 2026 15:35:09 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDE8762E0F;\n\tTue,  7 Apr 2026 17:35:08 +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 E6DC062DFF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Apr 2026 17:35:02 +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 UTF8SMTPSA id 6047A6A6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Apr 2026 17:33:35 +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=\"QD2pUbqe\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775576015;\n\tbh=ciUfVyVHVmbZDdVkctsK/9fbleSWzXsDOR4lyHxsANM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=QD2pUbqe35StF5JJk1YK/eqQ7+c8Ao8+lZCEepMJe2W31+H0c2mC8bpXyFmLog/Ws\n\tLbTleARGbn3Ut/55bKx5D15gpyp3nHme7RzRZk2xxGKmq5fl2rjI4/5o/FrHanhvgF\n\tnJMs1CAedKAckWGre/weQPkTKzeUnh1rhai4Mb7c=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v2 25/42] libcamera: value_node: Support looking up\n\tdescendant node by path",
        "Date": "Tue,  7 Apr 2026 18:34:10 +0300",
        "Message-ID": "<20260407153427.1825999-26-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "In-Reply-To": "<20260407153427.1825999-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20260407153427.1825999-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>\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 be28c2b73832..14c5e0eb0202 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 e8db7ef3c37f..990e46d70358 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": [
        "v2",
        "25/42"
    ]
}