Patch Detail
Show a patch.
GET /api/1.1/patches/1265/?format=api
{ "id": 1265, "url": "https://patchwork.libcamera.org/api/1.1/patches/1265/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1265/", "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": "<20190522221237.19400-1-laurent.pinchart@ideasonboard.com>", "date": "2019-05-22T22:12:37", "name": "[libcamera-devel] libcamera: camera: Simplify create() implementation", "commit_ref": "1f32abb995a04b7c67af6d923fea82436e817de1", "pull_url": null, "state": "accepted", "archived": false, "hash": "936d6d5667dca58ddd199b2f500b96f6ada85382", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1265/mbox/", "series": [ { "id": 320, "url": "https://patchwork.libcamera.org/api/1.1/series/320/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=320", "date": "2019-05-22T22:12:37", "name": "[libcamera-devel] libcamera: camera: Simplify create() implementation", "version": 1, "mbox": "https://patchwork.libcamera.org/series/320/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1265/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1265/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 30F9F60103\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 May 2019 00:13:02 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C60E5443\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 May 2019 00:13:01 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1558563181;\n\tbh=NROoCzaA1cMJqcqtDCrTF/cxmXByA7s9KvtBKmh4kk4=;\n\th=From:To:Subject:Date:From;\n\tb=cYz0NxF2fHWMW9EhwUg0OToeywmQfTdwHcBE3zOapLvOsVqRUBuSrNBbBnb2VyKbP\n\tIKqvgiVcb6pKnv5ikv9B25muhGmCO+LZmsZ4JD0BIIDiIE3tPEcWp8unNQeoAOBDhn\n\t0oAnFBhUMNlhinatTrlO8DiCVvZW3v4uhzkDVfig=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 23 May 2019 01:12:37 +0300", "Message-Id": "<20190522221237.19400-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: camera: Simplify create()\n\timplementation", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.23", "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": "Wed, 22 May 2019 22:13:02 -0000" }, "content": "Now that the Camera class inherits from std::enable_shared_from_this, we\ndon't need to use std::allocate_shared anymore and can simplify the\nCamera::create() implementation. This fixes compilation with recent\nversions of libc++ whose std::allocate_shared implementation isn't\ncompatible with classes that are not publicly constructible.\n\nThe custom allocator is removed, but a custom deleter is needed as the\nCamera destructor is private.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/camera.cpp | 17 +++++------------\n 1 file changed, 5 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 0f45ab7e4358..617ea99cdf71 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -358,24 +358,17 @@ std::shared_ptr<Camera> Camera::create(PipelineHandler *pipe,\n \t\t\t\t const std::string &name,\n \t\t\t\t const std::set<Stream *> &streams)\n {\n-\tstruct Allocator : std::allocator<Camera> {\n-\t\tvoid construct(void *p, PipelineHandler *pipe,\n-\t\t\t const std::string &name)\n+\tstruct Deleter : std::default_delete<Camera> {\n+\t\tvoid operator()(Camera *camera)\n \t\t{\n-\t\t\t::new(p) Camera(pipe, name);\n-\t\t}\n-\t\tvoid destroy(Camera *p)\n-\t\t{\n-\t\t\tp->~Camera();\n+\t\t\tdelete camera;\n \t\t}\n \t};\n \n-\tstd::shared_ptr<Camera> camera =\n-\t\tstd::allocate_shared<Camera>(Allocator(), pipe, name);\n-\n+\tCamera *camera = new Camera(pipe, name);\n \tcamera->streams_ = streams;\n \n-\treturn camera;\n+\treturn std::shared_ptr<Camera>(camera, Deleter());\n }\n \n /**\n", "prefixes": [ "libcamera-devel" ] }