Show a patch.

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

{
    "id": 23071,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23071/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23071/",
    "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": "<20250331141714.512538-2-barnabas.pocze@ideasonboard.com>",
    "date": "2025-03-31T14:17:13",
    "name": "[v2,2/3] libcamera: request: Avoid double map lookup",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6ddd6523d8fee228282ab415dc46146f1597c541",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23071/mbox/",
    "series": [
        {
            "id": 5093,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5093/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5093",
            "date": "2025-03-31T14:17:12",
            "name": "[v2,1/3] libcamera: request: Make `controls_`/`metadata_` members",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5093/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23071/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23071/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 CB3DAC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 31 Mar 2025 14:17:27 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5530668989;\n\tMon, 31 Mar 2025 16:17:25 +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 CE7056897A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Mar 2025 16:17:21 +0200 (CEST)",
            "from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4049082A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 31 Mar 2025 16:15:30 +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=\"R6i7yfNU\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743430530;\n\tbh=mDKs3DsA+6gULCwnaECzJszzkhmD/iBQI9xcY2dhuYs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=R6i7yfNUG0P9PA+bbvReUZQbt8Tggegc0Q/1EbaplU9ah+4F6I9isO1Tufm3frJ+l\n\tkqPkBrhBX857ZvcdBcHrKTgITYY/CiqXPfuH08tqNu8CABVEsALDRM2oNLBeb0h+lK\n\t1oF7jfULVm2fs59ThINqL6Hv9irqK3ivLNZZ47sM=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH v2 2/3] libcamera: request: Avoid double map lookup",
        "Date": "Mon, 31 Mar 2025 16:17:13 +0200",
        "Message-ID": "<20250331141714.512538-2-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250331141714.512538-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250331141714.512538-1-barnabas.pocze@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": "Use `try_emplace()` that more or less combines `find()` and `operator[]`\nin one function.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/libcamera/request.cpp | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex e7eb1c0c8..fc364441a 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -475,15 +475,14 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer,\n \t\treturn -EEXIST;\n \t}\n \n-\tauto it = bufferMap_.find(stream);\n-\tif (it != bufferMap_.end()) {\n+\tauto [it, inserted] = bufferMap_.try_emplace(stream, buffer);\n+\tif (!inserted) {\n \t\tLOG(Request, Error) << \"FrameBuffer already set for stream\";\n \t\treturn -EEXIST;\n \t}\n \n \tbuffer->_d()->setRequest(this);\n \t_d()->pending_.insert(buffer);\n-\tbufferMap_[stream] = buffer;\n \n \tif (fence && fence->isValid())\n \t\tbuffer->_d()->setFence(std::move(fence));\n",
    "prefixes": [
        "v2",
        "2/3"
    ]
}