Show a patch.

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

{
    "id": 20077,
    "url": "https://patchwork.libcamera.org/api/patches/20077/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20077/",
    "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": "<20240520035232.205777-1-pobrn@protonmail.com>",
    "date": "2024-05-20T03:52:33",
    "name": "[v1] libcamera: yaml_parser: Avoid double lookup in `operator[]`",
    "commit_ref": "168bb3c97c5f338486251ae7752bccd4e61ffcc0",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "812363629cfbd3a9188afe1ba205efcda7a20338",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20077/mbox/",
    "series": [
        {
            "id": 4318,
            "url": "https://patchwork.libcamera.org/api/series/4318/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4318",
            "date": "2024-05-20T03:52:33",
            "name": "[v1] libcamera: yaml_parser: Avoid double lookup in `operator[]`",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4318/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20077/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20077/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 B4F77BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 20 May 2024 03:52:42 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4AFC6346B;\n\tMon, 20 May 2024 05:52:41 +0200 (CEST)",
            "from mail-4322.protonmail.ch (mail-4322.protonmail.ch\n\t[185.70.43.22])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CDF861A4D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 20 May 2024 05:52:40 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"oXPs0z26\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1716177159; x=1716436359;\n\tbh=MShWpaRHXxxdimUORIqNYMuInBN6XYPtaDPuka5gWJY=;\n\th=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n\tSubject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n\tb=oXPs0z2640hDytJdxRY9A0rW0SVTpIE62oSNl+XymvB3CHMGJpYkT7uI4Z6jzvpDK\n\tn9fda0nKIu1gknRUqlj1AC2O9rWBCCmpDEOdfBcxKma5aBa6i4fZt6eSf7j66Ag7II\n\tjjJeHjGAs0D4mN0JVp8K+Q1BijYlKXw81D+2auvxN7TUNynw5byE85+a+pTQEczIuX\n\tsswrxJJKmtOIJjI6ah5MFYfzjSi45XaevAjjt/gLNFs/1Tf6vXjtKYY4gncS8RF3q1\n\tcPykwGMciLAiiFyXt571GXP3lvT8K2bFg2PGtMPNSfp91iWwYqT2DOQcUrOxUULzvA\n\tRLl2OkKgXNCmQ==",
        "Date": "Mon, 20 May 2024 03:52:33 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Subject": "[PATCH v1] libcamera: yaml_parser: Avoid double lookup in\n\t`operator[]`",
        "Message-ID": "<20240520035232.205777-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "X-Pm-Message-ID": "097afb9f0ad7a09008cf6b17079ff986ec256172",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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": "`YamlObject::contains()` does the same search,\ndoing the lookup twice in unnecessary.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/libcamera/yaml_parser.cpp | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex 55f81916..aac9a2bd 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -468,10 +468,13 @@ bool YamlObject::contains(const std::string &key) const\n  */\n const YamlObject &YamlObject::operator[](const std::string &key) const\n {\n-\tif (type_ != Type::Dictionary || !contains(key))\n+\tif (type_ != Type::Dictionary)\n \t\treturn empty;\n \n \tauto iter = dictionary_.find(key);\n+\tif (iter == dictionary_.end())\n+\t\treturn empty;\n+\n \treturn *iter->second;\n }\n \n",
    "prefixes": [
        "v1"
    ]
}