Show a patch.

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

{
    "id": 3544,
    "url": "https://patchwork.libcamera.org/api/patches/3544/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3544/",
    "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": "<20200425231623.6505-1-laurent.pinchart@ideasonboard.com>",
    "date": "2020-04-25T23:16:22",
    "name": "[libcamera-devel,1/2] libcamera: controls: Return ControlValue reference from ControlList::set()",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "7e3e27eace9fa2086a1b35fc357ab944b834ca67",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/3544/mbox/",
    "series": [
        {
            "id": 826,
            "url": "https://patchwork.libcamera.org/api/series/826/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=826",
            "date": "2020-04-25T23:16:22",
            "name": "[libcamera-devel,1/2] libcamera: controls: Return ControlValue reference from ControlList::set()",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/826/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3544/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3544/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CEDDB603FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 26 Apr 2020 01:16:41 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3DFB84F7;\n\tSun, 26 Apr 2020 01:16:41 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"qZ7xzRTw\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1587856601;\n\tbh=UkjB9ANiqnfRJ3FzWVHqjroZgqqC4m7kiUIXDtrFLfs=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=qZ7xzRTw7dujmrPfznPDw8WiZ8/A2AGkhC/Jeq81G+Z0pVO8+f9YDc8qwqNiIbadH\n\tl3+bfG6Kh7hdY3a2UBUe4cmXtW28PF7ddhO0O/q4WTBDhhWyXus1mDhCIqQE0UNw5w\n\t1zJSXOQfI8TtyohO0c6fzCG10oOepsyIPHsUnYm0=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sun, 26 Apr 2020 02:16:22 +0300",
        "Message-Id": "<20200425231623.6505-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.3",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: controls: Return\n\tControlValue reference from ControlList::set()",
        "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>",
        "X-List-Received-Date": "Sat, 25 Apr 2020 23:16:42 -0000"
    },
    "content": "It is useful for the caller of ControlList::set() to get a reference to\nthe ControlValue that stores the control in the control list, in order\nto then modify that value directly. This allows creating an entry in\nthe ControlList and then reserving memory for the control when getting\nV4L2 controls from a device. This is already possible by calling the\nget() function right after set(), but results in two lookups. Extend the\nid-based set() function to return the reference to the inserted\nControlValue to avoid the second lookup.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/controls.h | 2 +-\n src/libcamera/controls.cpp   | 7 +++++--\n 2 files changed, 6 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 80944efc133a..5a5cfc3e52ca 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -394,7 +394,7 @@ public:\n \t}\n \n \tconst ControlValue &get(unsigned int id) const;\n-\tvoid set(unsigned int id, const ControlValue &value);\n+\tControlValue &set(unsigned int id, const ControlValue &value);\n \n \tconst ControlInfoMap *infoMap() const { return infoMap_; }\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 08df7f29e938..12822e87a4d7 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -930,14 +930,17 @@ const ControlValue &ControlList::get(unsigned int id) const\n  *\n  * The behaviour is undefined if the control \\a id is not supported by the\n  * object that the list refers to.\n+ *\n+ * \\return A reference to the ControlValue stored in the control list\n  */\n-void ControlList::set(unsigned int id, const ControlValue &value)\n+ControlValue &ControlList::set(unsigned int id, const ControlValue &value)\n {\n \tControlValue *val = find(id);\n \tif (!val)\n-\t\treturn;\n+\t\treturn *val;\n \n \t*val = value;\n+\treturn *val;\n }\n \n /**\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}