Show a patch.

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

{
    "id": 23194,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23194/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23194/",
    "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": "<20250421153556.171192-5-barnabas.pocze@ideasonboard.com>",
    "date": "2025-04-21T15:35:55",
    "name": "[v2,4/5] libcamera: controls: Implement `swap()`",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "8bb56e8d28fb8b7e783817fff6e69888a9ed75dd",
    "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/23194/mbox/",
    "series": [
        {
            "id": 5135,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5135/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5135",
            "date": "2025-04-21T15:35:51",
            "name": "libcamera: controls: Move constructor/assignment + swap",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5135/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23194/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23194/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 0E1E0C331E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 21 Apr 2025 15:36:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E876268ACA;\n\tMon, 21 Apr 2025 17:36:07 +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 16EE568AC2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 21 Apr 2025 17:36:01 +0200 (CEST)",
            "from pb-laptop.local (185.221.143.16.nat.pool.zt.hu\n\t[185.221.143.16])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6AC566D5;\n\tMon, 21 Apr 2025 17:33:54 +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=\"cNcDB6T8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1745249634;\n\tbh=1cAs7nNJZnmC61fakZ7EkFpphcpojXJw7mR0Xw6X6/c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cNcDB6T8bVyj9WGlvefoJhi7GerW7kpzZlK3nH5C7LRM1aT6nDk99g6myEvdLDV7D\n\t2Sls2/nCWfHyKec8wYvPsQIusYk3fU20QvO1MAjo4qF3PGuZVb0r1tnkjWpO1gECzx\n\tCKw5UeF1JeCtQHdA3T7BIsmAdc9alFJB3Bmwkc5M=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Subject": "[PATCH v2 4/5] libcamera: controls: Implement `swap()`",
        "Date": "Mon, 21 Apr 2025 17:35:55 +0200",
        "Message-ID": "<20250421153556.171192-5-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250421153556.171192-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250421153556.171192-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": "Implement both free and member function `swap()` for `ControlValue`.\nThe general `std::swap()` swaps two values by combining a move construction\nand two move assignments, but for `ControlValue` a simpler implementation\ncan be provided by just swapping the members.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/controls.h | 19 +++++++++++++++++++\n src/libcamera/controls.cpp   | 15 +++++++++++++++\n 2 files changed, 34 insertions(+)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 866d667c4..62ee5ebd6 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -259,6 +259,25 @@ public:\n \tvoid reserve(ControlType type, bool isArray = false,\n \t\t     std::size_t numElements = 1);\n \n+\tvoid swap(ControlValue &other) noexcept\n+\t{\n+\t\t/* `type_` is a bit field, so `std::swap()` cannot be used. */\n+\t\t{\n+\t\t\tauto tmp = type_;\n+\t\t\ttype_ = other.type_;\n+\t\t\tother.type_ = tmp;\n+\t\t}\n+\n+\t\tstd::swap(isArray_, other.isArray_);\n+\t\tstd::swap(numElements_, other.numElements_);\n+\t\tstd::swap(storage_, other.storage_);\n+\t}\n+\n+\tfriend void swap(ControlValue &a, ControlValue &b) noexcept\n+\t{\n+\t\ta.swap(b);\n+\t}\n+\n private:\n \tControlType type_ : 8;\n \tbool isArray_;\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 135e87613..ae54f8c77 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -412,6 +412,21 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n \t\tstorage_.external = new uint8_t[newSize];\n }\n \n+/**\n+ * \\fn ControlValue::swap(ControlValue &other) noexcept\n+ * \\brief Swap two control values\n+ *\n+ * This function swaps the contained value of \\a this with that of \\a other.\n+ */\n+\n+/**\n+ * \\fn ControlValue::swap(ControlValue &a, ControlValue &b) noexcept\n+ * \\brief Swap two control values\n+ *\n+ * This function swaps the contained value of \\a a with that of \\a b.\n+ * \\sa ControlValue::swap()\n+ */\n+\n /**\n  * \\class ControlId\n  * \\brief Control static metadata\n",
    "prefixes": [
        "v2",
        "4/5"
    ]
}