Show a patch.

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

{
    "id": 2550,
    "url": "https://patchwork.libcamera.org/api/patches/2550/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2550/",
    "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": "<20200110193808.2266294-4-niklas.soderlund@ragnatech.se>",
    "date": "2020-01-10T19:37:38",
    "name": "[libcamera-devel,v3,03/33] libcamera: utils: Add exchange()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "83d2430f5f2962721231776d333aedf7044a713d",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2550/mbox/",
    "series": [
        {
            "id": 615,
            "url": "https://patchwork.libcamera.org/api/series/615/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=615",
            "date": "2020-01-10T19:37:35",
            "name": "libcamera: Rework buffer API",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/615/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2550/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2550/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5756160673\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jan 2020 20:38:38 +0100 (CET)",
            "from bismarck.berto.se (p54ac5d7b.dip0.t-ipconnect.de\n\t[84.172.93.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid ca3d4738-33e0-11ea-b6d8-005056917f90;\n\tFri, 10 Jan 2020 20:38:34 +0100 (CET)"
        ],
        "X-Halon-ID": "ca3d4738-33e0-11ea-b6d8-005056917f90",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 10 Jan 2020 20:37:38 +0100",
        "Message-Id": "<20200110193808.2266294-4-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200110193808.2266294-1-niklas.soderlund@ragnatech.se>",
        "References": "<20200110193808.2266294-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v3 03/33] libcamera: utils: Add exchange()",
        "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": "Fri, 10 Jan 2020 19:38:38 -0000"
    },
    "content": "C++11 does not support std::exchange(), add a custom implementation in\nutils.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/utils.h | 9 +++++++++\n src/libcamera/utils.cpp       | 8 ++++++++\n 2 files changed, 17 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex badc77533fa15f09..6470cadc2c6c1234 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -67,6 +67,15 @@ const T& clamp(const T& v, const T& lo, const T& hi)\n \treturn std::max(lo, std::min(v, hi));\n }\n \n+/* C++11 doesn't provide std::exchange */\n+template<class T, class U = T>\n+T exchange(T &obj, U &&new_value)\n+{\n+\tT old_value = std::move(obj);\n+\tobj = std::forward<U>(new_value);\n+\treturn old_value;\n+}\n+\n using clock = std::chrono::steady_clock;\n using duration = std::chrono::steady_clock::duration;\n using time_point = std::chrono::steady_clock::time_point;\ndiff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex 5de9e4813353b23c..a7e573ac45aec914 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -95,6 +95,14 @@ char *secure_getenv(const char *name)\n  * \\return lo if v is less than lo, hi if v is greater than hi, otherwise v\n  */\n \n+/**\n+ * \\fn libcamera::utils::exchange(T &obj, U &&new_value)\n+ * \\brief Replace the value of \\a obj with \\a new_value and return the old value\n+ * \\param[inout] obj Object whose value to replace\n+ * \\param[in] new_value The value to assign to obj\n+ * \\return The old value of \\a obj\n+ */\n+\n /**\n  * \\typedef clock\n  * \\brief The libcamera clock (monotonic)\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "03/33"
    ]
}