Show a patch.

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

{
    "id": 26466,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26466/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26466/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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-27-laurent.pinchart@ideasonboard.com>",
    "date": "2026-04-07T15:34:11",
    "name": "[v2,26/42] libcamera: value_node: Add functions to erase child nodes",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cbb9baa4763e57151d8d85952885108b38e013a2",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26466/mbox/",
    "series": [
        {
            "id": 5873,
            "url": "https://patchwork.libcamera.org/api/1.1/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/26466/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26466/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 43065C330F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Apr 2026 15:35:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B369C62E19;\n\tTue,  7 Apr 2026 17:35:09 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D3AB62DFA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Apr 2026 17:35:04 +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 B400C6DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Apr 2026 17:33:36 +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=\"AUTP5JaN\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775576016;\n\tbh=RBN/KyATuh2ePugqLEn7mn3YOx/34nrCZSFLXo1eNVY=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=AUTP5JaN9PfD6C1g2s4Uf/LKAYp0QebhbXGdhcuyu9KICQr6HNO1QqMn2wEf9TEPF\n\tYDokhjOIFULlgHYXRcg262PUtCnRgHQ+iveqSWbiXKbJpvia6h+GOPWI1ef7CZ3bBR\n\twZ+A4t/U0DcXkkKSVaK9fc5pkUEjJs5YVXXd2DL0=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v2 26/42] libcamera: value_node: Add functions to erase child\n\tnodes",
        "Date": "Tue,  7 Apr 2026 18:34:11 +0300",
        "Message-ID": "<20260407153427.1825999-27-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-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": "There will be a need to erase child nodes when implementing support for\noverriding configuration options. Add two erase() functions to the\nValueNode class, mimicking the add() API.\n\nMore erase() overloads could be added, for instance taking iterators as\nparameters, to improve efficiency. This should be considered later, when\nusage of the ValueNode class will expand, based on the actual usage\npatterns.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/value_node.h |  3 ++\n src/libcamera/value_node.cpp            | 51 +++++++++++++++++++++++++\n 2 files changed, 54 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/value_node.h b/include/libcamera/internal/value_node.h\nindex 14c5e0eb0202..4e3757af7d09 100644\n--- a/include/libcamera/internal/value_node.h\n+++ b/include/libcamera/internal/value_node.h\n@@ -244,6 +244,9 @@ public:\n \tValueNode *add(std::initializer_list<std::string_view> path,\n \t\t       std::unique_ptr<ValueNode> &&child);\n \n+\tvoid erase(const std::string &key);\n+\tvoid erase(std::initializer_list<std::string_view> path);\n+\n private:\n \tLIBCAMERA_DISABLE_COPY_AND_MOVE(ValueNode)\n \ndiff --git a/src/libcamera/value_node.cpp b/src/libcamera/value_node.cpp\nindex 990e46d70358..8a1af13a5d6e 100644\n--- a/src/libcamera/value_node.cpp\n+++ b/src/libcamera/value_node.cpp\n@@ -621,4 +621,55 @@ ValueNode *ValueNode::add(std::initializer_list<std::string_view> path,\n \treturn node;\n }\n \n+/**\n+ * \\brief Erase a child node in a dictionary\n+ * \\param[in] key The dictionary key\n+ *\n+ * Erase the child node referenced by \\a key in a dictionary node. If the \\a\n+ * key does not exist, or if this node is not a dictionary, the function\n+ * returns without performing any operation.\n+ */\n+void ValueNode::erase(const std::string &key)\n+{\n+\tauto node = dictionary_.extract(key);\n+\tif (node.empty())\n+\t\treturn;\n+\n+\tfor (auto iter = list_.begin(); iter != list_.end(); ++iter) {\n+\t\tif (iter->value.get() != node.mapped())\n+\t\t\tcontinue;\n+\n+\t\tlist_.erase(iter);\n+\t\treturn;\n+\t}\n+}\n+\n+/**\n+ * \\brief Erase the child node at the given path\n+ * \\param[in] path The path\n+ *\n+ * Erase the child node at the given \\a path. If no child node exists for the\n+ * path, the function returns without performing any operation.\n+ */\n+void ValueNode::erase(std::initializer_list<std::string_view> path)\n+{\n+\tif (!path.size())\n+\t\treturn;\n+\n+\tValueNode *node = this;\n+\n+\tfor (const auto [i, name] : utils::enumerate(path)) {\n+\t\tif (i == path.size() - 1) {\n+\t\t\tnode->erase(std::string{ name });\n+\t\t\treturn;\n+\t\t}\n+\n+\t\tauto iter = node->dictionary_.find(name);\n+\t\tif (iter == node->dictionary_.end())\n+\t\t\treturn;\n+\n+\t\tnode = iter->second;\n+\t}\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "v2",
        "26/42"
    ]
}