Show a patch.

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

{
    "id": 18537,
    "url": "https://patchwork.libcamera.org/api/patches/18537/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18537/",
    "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": "<20230418160301.445828-1-pobrn@protonmail.com>",
    "date": "2023-04-18T16:03:03",
    "name": "[libcamera-devel] libcamera: device_enumerator_udev: Use std::string_view",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "17125f5c09ab2c908711b64d8c1398565b3ecb17",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18537/mbox/",
    "series": [
        {
            "id": 3842,
            "url": "https://patchwork.libcamera.org/api/series/3842/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3842",
            "date": "2023-04-18T16:03:03",
            "name": "[libcamera-devel] libcamera: device_enumerator_udev: Use std::string_view",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3842/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18537/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18537/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4D83BBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 18 Apr 2023 16:03:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F969627B1;\n\tTue, 18 Apr 2023 18:03:25 +0200 (CEST)",
            "from mail-40131.protonmail.ch (mail-40131.protonmail.ch\n\t[185.70.40.131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C858603A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Apr 2023 18:03:23 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1681833805;\n\tbh=KWmjLaINvHtPTQwwlEQLGSJ5Lj+077dmhvQkokyygWg=;\n\th=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=Y+utlTpu/pZT02menYswaTl4xnyMpCWwYiKaoeZribGeuiYD61pskC9pX2ffrW7CJ\n\tLcOL2ZfriQzIxr5OQ05q9o6PMcFjOSx8hXhdqR5pUVOmIRYfrPlaks5wtTgmGXSQsg\n\tLSi07PGYu0O4QIS2+gOU8050xaFOqEra02azbik8Uvm71GBOrM/5+iyiezst4DFWD3\n\t6J0yrJFdzas8FQWxrk8ERLBIMUevn+6wNw160Zn/xN4CxpCoFSKE8EpgO006G6p6Xg\n\totNNdBevXRZUB0/A4SxMGipsYq9MRiqvJYtX1pEGp2nYeOB1Nl6B3e9Ed58ZlQd/5Y\n\tpPrBAetuDyGow==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1681833793; x=1682092993;\n\tbh=KWmjLaINvHtPTQwwlEQLGSJ5Lj+077dmhvQkokyygWg=;\n\th=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n\tSubject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n\tb=Afb8Nx7GmcyTN1hmad819Ygh9gr0f/6N3JjhN+B78Fqtkq2uFgSnKJ53v8SQEOTr0\n\tQaIQirm5J67yGT34Iv1UPnNmVmhLAOqhdYkCeRK8A3NmhFNctfYJeN40tWS7wsPW/I\n\t+fKX9kdg3h9NpzKhnZAf8SuyR1ouwh0z9dfyEeZxi/AqcocWP1yfYWLUrHraRsk4II\n\t14RMxT7JOfLj8ASGwEAouUXh6Wt0Vt3eKRzmgtPaGQFUEoHopc3lE6NhSJ+C5QOtl+\n\t9aC5U9asjYJW0RYdfxiysHjI9BshYaaF9fFlQX+JBUTkolUeS5drtvuuoyv5RRhWAq\n\tsstIoeARgOCAg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=protonmail.com\n\theader.i=@protonmail.com\n\theader.b=\"Afb8Nx7G\"; dkim-atps=neutral",
        "Date": "Tue, 18 Apr 2023 16:03:03 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "Message-ID": "<20230418160301.445828-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "Subject": "[libcamera-devel] [PATCH] libcamera: device_enumerator_udev: Use\n\tstd::string_view",
        "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>",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze_via_libcamera-devel?=\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "In `udevNotify()`, use `std::string_view` and defer the necessary\n`std::string` construction to the last possible point.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/libcamera/device_enumerator_udev.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\n--\n2.40.0",
    "diff": "diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex a63cd360..0abc1248 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -13,6 +13,7 @@\n #include <list>\n #include <map>\n #include <string.h>\n+#include <string_view>\n #include <sys/ioctl.h>\n #include <sys/sysmacros.h>\n #include <unistd.h>\n@@ -331,18 +332,18 @@ int DeviceEnumeratorUdev::addV4L2Device(dev_t devnum)\n void DeviceEnumeratorUdev::udevNotify()\n {\n \tstruct udev_device *dev = udev_monitor_receive_device(monitor_);\n-\tstd::string action(udev_device_get_action(dev));\n-\tstd::string deviceNode(udev_device_get_devnode(dev));\n+\tstd::string_view action(udev_device_get_action(dev));\n+\tstd::string_view deviceNode(udev_device_get_devnode(dev));\n\n \tLOG(DeviceEnumerator, Debug)\n-\t\t<< action << \" device \" << udev_device_get_devnode(dev);\n+\t\t<< action << \" device \" << deviceNode;\n\n \tif (action == \"add\") {\n \t\taddUdevDevice(dev);\n \t} else if (action == \"remove\") {\n \t\tconst char *subsystem = udev_device_get_subsystem(dev);\n \t\tif (subsystem && !strcmp(subsystem, \"media\"))\n-\t\t\tremoveDevice(deviceNode);\n+\t\t\tremoveDevice(std::string(deviceNode));\n \t}\n\n \tudev_device_unref(dev);\n",
    "prefixes": [
        "libcamera-devel"
    ]
}