Show a patch.

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

{
    "id": 2498,
    "url": "https://patchwork.libcamera.org/api/patches/2498/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2498/",
    "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": "<20200104050947.7673-3-laurent.pinchart@ideasonboard.com>",
    "date": "2020-01-04T05:09:35",
    "name": "[libcamera-devel,02/14] libcamera: object: Use activate() in invokeMethod()",
    "commit_ref": "a915a65fab5b202b51fadf585797384adb7f6b0c",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ee4a6fd98dc0f7e2c85f1bb87ef2dc2df305d51c",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2498/mbox/",
    "series": [
        {
            "id": 600,
            "url": "https://patchwork.libcamera.org/api/series/600/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=600",
            "date": "2020-01-04T05:09:33",
            "name": "object: Propagate return value of invoked method",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/600/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2498/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2498/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 9482B60466\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jan 2020 06:10:03 +0100 (CET)",
            "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 3A79F30F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jan 2020 06:10:03 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578114603;\n\tbh=v6EUKuas02m+ruXKnuLeIxHV2wUXG5+a5yQQjjjkQDI=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=r3OMg6wxrLHvrTuAn2tYBG7j6DCHg5OJa6GPRB4xFXri6OwRUD8MVE2E/p6yFkryl\n\tu7G6rDY68HVhnmUgIO+JTsnsWkk2+vQO1ye435WPznvZzYUuTo0XXNl+c7L1ztlPww\n\tiGQ5+/eSVpK1oQXxhzDdbrpydQsHr8fRQ7visJ3c=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat,  4 Jan 2020 07:09:35 +0200",
        "Message-Id": "<20200104050947.7673-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200104050947.7673-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200104050947.7673-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 02/14] libcamera: object: Use activate()\n\tin invokeMethod()",
        "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, 04 Jan 2020 05:10:03 -0000"
    },
    "content": "The Object::invokeMethod() implementation duplicates pack creation code\nfrom BoundMemberMethod::activate(). Call activate() instead of\nactivatePack() to share code.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/bound_method.h | 15 ++++++++++-----\n include/libcamera/object.h       |  7 ++-----\n 2 files changed, 12 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h\nindex b841a2aed147..5743cacf5388 100644\n--- a/include/libcamera/bound_method.h\n+++ b/include/libcamera/bound_method.h\n@@ -37,10 +37,11 @@ public:\n \tObject *object() const { return object_; }\n \tConnectionType connectionType() const { return connectionType_; }\n \n-\tvoid activatePack(void *pack, bool deleteMethod);\n \tvirtual void invokePack(void *pack) = 0;\n \n protected:\n+\tvoid activatePack(void *pack, bool deleteMethod);\n+\n \tvoid *obj_;\n \tObject *object_;\n \tConnectionType connectionType_;\n@@ -88,7 +89,7 @@ public:\n \t\tinvokePack(pack, typename generator<sizeof...(Args)>::type());\n \t}\n \n-\tvirtual void activate(Args... args) = 0;\n+\tvirtual void activate(Args... args, bool deleteMethod = false) = 0;\n \tvirtual void invoke(Args... args) = 0;\n };\n \n@@ -106,10 +107,10 @@ public:\n \n \tbool match(void (T::*func)(Args...)) const { return func == func_; }\n \n-\tvoid activate(Args... args)\n+\tvoid activate(Args... args, bool deleteMethod = false)\n \t{\n \t\tif (this->object_)\n-\t\t\tBoundMethodBase::activatePack(new PackType{ args... }, false);\n+\t\t\tBoundMethodBase::activatePack(new PackType{ args... }, deleteMethod);\n \t\telse\n \t\t\t(static_cast<T *>(this->obj_)->*func_)(args...);\n \t}\n@@ -135,7 +136,11 @@ public:\n \n \tbool match(void (*func)(Args...)) const { return func == func_; }\n \n-\tvoid activate(Args... args) { (*func_)(args...); }\n+\tvoid activate(Args... args, bool deleteMethod = false)\n+\t{\n+\t\t(*func_)(args...);\n+\t}\n+\n \tvoid invoke(Args...) {}\n \n private:\ndiff --git a/include/libcamera/object.h b/include/libcamera/object.h\nindex 21b70460b516..c45165dec8ef 100644\n--- a/include/libcamera/object.h\n+++ b/include/libcamera/object.h\n@@ -35,11 +35,8 @@ public:\n \t\t\t  Args... args)\n \t{\n \t\tT *obj = static_cast<T *>(this);\n-\t\tBoundMethodBase *method =\n-\t\t\tnew BoundMemberMethod<T, FuncArgs...>(obj, this, func, type);\n-\t\tvoid *pack = new typename BoundMemberMethod<T, FuncArgs...>::PackType{ args... };\n-\n-\t\tmethod->activatePack(pack, true);\n+\t\tauto *method = new BoundMemberMethod<T, FuncArgs...>(obj, this, func, type);\n+\t\tmethod->activate(args..., true);\n \t}\n \n \tThread *thread() const { return thread_; }\n",
    "prefixes": [
        "libcamera-devel",
        "02/14"
    ]
}