Show a patch.

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

{
    "id": 2425,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2425/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2425/",
    "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": "<20191216121029.1048242-2-niklas.soderlund@ragnatech.se>",
    "date": "2019-12-16T12:10:27",
    "name": "[libcamera-devel,1/3] libcamera: utils: Add exchange()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a7fdd7925ffec9ab93e135301d31018c6ec3364f",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2425/mbox/",
    "series": [
        {
            "id": 588,
            "url": "https://patchwork.libcamera.org/api/1.1/series/588/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=588",
            "date": "2019-12-16T12:10:26",
            "name": "libcamera: Add FileDescriptor to help pass numerical fds around",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/588/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2425/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2425/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CA622601E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2019 13:10:57 +0100 (CET)",
            "from bismarck.berto.se (p54ac5865.dip0.t-ipconnect.de\n\t[84.172.88.101]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid 167af101-1ffd-11ea-8e92-005056917f90;\n\tMon, 16 Dec 2019 13:10:51 +0100 (CET)"
        ],
        "X-Halon-ID": "167af101-1ffd-11ea-8e92-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": "Mon, 16 Dec 2019 13:10:27 +0100",
        "Message-Id": "<20191216121029.1048242-2-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.24.0",
        "In-Reply-To": "<20191216121029.1048242-1-niklas.soderlund@ragnatech.se>",
        "References": "<20191216121029.1048242-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/3] 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": "Mon, 16 Dec 2019 12:10:58 -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>\n---\n src/libcamera/include/utils.h | 9 +++++++++\n src/libcamera/utils.cpp       | 7 +++++++\n 2 files changed, 16 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex a80f7d096bf725a1..32e3b009040d9efc 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -66,6 +66,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 d632f6e66638038d..0e2decd966dd8d0c 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -95,6 +95,13 @@ 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+ * \\param[in] obj object whose value to replace\n+ * \\param[in] new_value the value to assign to obj\n+ * \\return The old value of obj\n+ */\n+\n /**\n  * \\typedef clock\n  * \\brief The libcamera clock (monotonic)\n",
    "prefixes": [
        "libcamera-devel",
        "1/3"
    ]
}