Show a patch.

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

{
    "id": 3667,
    "url": "https://patchwork.libcamera.org/api/patches/3667/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3667/",
    "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": "<20200502135355.22757-3-laurent.pinchart@ideasonboard.com>",
    "date": "2020-05-02T13:53:54",
    "name": "[libcamera-devel,2/3] libcamera: camera_sensor: Store subdevice in std::unique_ptr",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f0a58f18863ec12d15176db984ddfa47268cee05",
    "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/3667/mbox/",
    "series": [
        {
            "id": 871,
            "url": "https://patchwork.libcamera.org/api/series/871/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=871",
            "date": "2020-05-02T13:53:52",
            "name": "libcamera: Prepare to support more complex sensors",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/871/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3667/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3667/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 79D6A61632\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  2 May 2020 15:54:03 +0200 (CEST)",
            "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 A54CD521\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  2 May 2020 15:54:02 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RCqPYELr\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588427642;\n\tbh=FmAEuxMTptQY2dFF+o4azp4/AAyMQKLRr1GghYzWMS8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=RCqPYELrATOufehlpqEHt9tlN8r6hag64QiwDWT9PdFFQIJdekzN+QjHpPwwpE05K\n\t+pfjZENHXJZ+CLe1tWChF2EWbcR+E4nh/lFdlFzof75qaSSKIEq/VIb+2RMIMf0fTL\n\t8nX7OlN8orDYr3/3Fx1+0AvA6GYAvp1LEfNKAoq4=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat,  2 May 2020 16:53:54 +0300",
        "Message-Id": "<20200502135355.22757-3-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.25.3",
        "In-Reply-To": "<20200502135355.22757-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200502135355.22757-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/3] libcamera: camera_sensor: Store\n\tsubdevice in std::unique_ptr",
        "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, 02 May 2020 13:54:03 -0000"
    },
    "content": "Avoid the need for a manual delete in the destructor by using a unique\npointer.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/camera_sensor.cpp       | 5 ++---\n src/libcamera/include/camera_sensor.h | 3 ++-\n 2 files changed, 4 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex ab2bed561cc6..9cfb3847dda6 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -133,7 +133,6 @@ LOG_DEFINE_CATEGORY(CameraSensor);\n CameraSensor::CameraSensor(const MediaEntity *entity)\n \t: entity_(entity), properties_(properties::properties)\n {\n-\tsubdev_ = new V4L2Subdevice(entity);\n }\n \n /**\n@@ -141,7 +140,6 @@ CameraSensor::CameraSensor(const MediaEntity *entity)\n  */\n CameraSensor::~CameraSensor()\n {\n-\tdelete subdev_;\n }\n \n /**\n@@ -197,7 +195,8 @@ int CameraSensor::init()\n \telse\n \t\tmodel_ = entityName;\n \n-\t/* Open the subdev. */\n+\t/* Create and open the subdev. */\n+\tsubdev_ = std::make_unique<V4L2Subdevice>(entity_);\n \tret = subdev_->open();\n \tif (ret < 0)\n \t\treturn ret;\ndiff --git a/src/libcamera/include/camera_sensor.h b/src/libcamera/include/camera_sensor.h\nindex f39ea96dc77a..92cd90353e72 100644\n--- a/src/libcamera/include/camera_sensor.h\n+++ b/src/libcamera/include/camera_sensor.h\n@@ -7,6 +7,7 @@\n #ifndef __LIBCAMERA_CAMERA_SENSOR_H__\n #define __LIBCAMERA_CAMERA_SENSOR_H__\n \n+#include <memory>\n #include <string>\n #include <vector>\n \n@@ -68,7 +69,7 @@ protected:\n \n private:\n \tconst MediaEntity *entity_;\n-\tV4L2Subdevice *subdev_;\n+\tstd::unique_ptr<V4L2Subdevice> subdev_;\n \tstd::string model_;\n \n \tstd::vector<unsigned int> mbusCodes_;\n",
    "prefixes": [
        "libcamera-devel",
        "2/3"
    ]
}