Show a patch.

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

{
    "id": 22316,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/22316/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22316/",
    "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": "<20241215204802.850593-1-pobrn@protonmail.com>",
    "date": "2024-12-15T20:48:06",
    "name": "[RFC,v1] treewide: Prefer `std::string_view` over `const std::string&` in parameters",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "35582b67ac7ba64ea3e69a9c3096a425cbef19d0",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/1.1/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22316/mbox/",
    "series": [
        {
            "id": 4885,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4885/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4885",
            "date": "2024-12-15T20:48:06",
            "name": "[RFC,v1] treewide: Prefer `std::string_view` over `const std::string&` in parameters",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4885/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22316/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22316/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 6C9A8C32F5\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 15 Dec 2024 20:48:13 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7062267F1E;\n\tSun, 15 Dec 2024 21:48:12 +0100 (CET)",
            "from mail-4322.protonmail.ch (mail-4322.protonmail.ch\n\t[185.70.43.22])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52EBD67EEE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Dec 2024 21:48:11 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"VVm3HyU7\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1734295690; x=1734554890;\n\tbh=I6Mt63KjadUw8xS0iKrXi5ZpoVpZu6Drkhd8OpfxmjA=;\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\tList-Unsubscribe:List-Unsubscribe-Post;\n\tb=VVm3HyU73+f60l2K/RBTZ3+kZGadBMYHxaQXYOBLss1Gwx8zDMgb/I+p6SwoETCdh\n\tJiqLdVYCydM+zxyzS2VzRgJdgYZD8Sm9vOzJB/GbLNEGrzg9NSe2/gEsVNTL5Ub0rF\n\tzX+QQvnDvgexiO97uwFM0rSrxM909/qXQEMBunL5Wmpa81E9EnQJ/+X7H2X37FZLBa\n\tmz2mcPwU+btYQLD7yOU1vlHIuYhrvy8LSnlE6Vw6VOATmTOrj+U9YSGDgrhvX1Bwn6\n\tsDoB63fmskLBZWWzPy6FwAyMj3gcM0yIQHcxWhqud6AdvNwwuuO927IgtwzJcKWvEe\n\tfAsbjn6Wt06nw==",
        "Date": "Sun, 15 Dec 2024 20:48:06 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Subject": "[RFC PATCH v1] treewide: Prefer `std::string_view` over `const\n\tstd::string&` in parameters",
        "Message-ID": "<20241215204802.850593-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "X-Pm-Message-ID": "6aa4b86e93e735c90db9c06e470bcefeda914cc1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "A parameter of type `const std::string&` is not the right choice in\nalmost all cases. It forces the caller to construct an `std::string`\nif they don't already have one, and accessing its data requires\nan extra indirection. Furthermore, `std::string` is just one\ninstantiation of `std::basic_string<>`, using e.g. a different\nallocator would immediately make it incompatible.\n\nIn contrast to that using an `std::string_view` is better if\nNUL termination is not needed since no `std::string` construction\nis required, and in many cases it can be passed directly in registers.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n include/libcamera/base/utils.h                     | 10 +++++-----\n include/libcamera/camera_manager.h                 |  3 ++-\n .../libcamera/internal/camera_sensor_properties.h  |  4 ++--\n include/libcamera/internal/device_enumerator.h     |  3 ++-\n include/libcamera/internal/formats.h               |  3 ++-\n include/libcamera/internal/media_device.h          |  7 ++++---\n include/libcamera/internal/pipeline_handler.h      |  3 ++-\n include/libcamera/internal/v4l2_subdevice.h        |  3 ++-\n include/libcamera/internal/v4l2_videodevice.h      |  3 ++-\n include/libcamera/pixel_format.h                   |  3 ++-\n src/apps/cam/capture_script.cpp                    |  2 +-\n src/apps/cam/capture_script.h                      |  3 ++-\n src/apps/cam/drm.cpp                               |  8 ++++----\n src/apps/cam/drm.h                                 |  9 +++++----\n src/ipa/libipa/camera_sensor_helper.cpp            |  2 +-\n src/ipa/libipa/camera_sensor_helper.h              |  3 ++-\n src/ipa/libipa/module.cpp                          |  2 +-\n src/ipa/libipa/module.h                            |  4 ++--\n src/libcamera/base/utils.cpp                       |  8 ++++----\n src/libcamera/camera_manager.cpp                   |  2 +-\n src/libcamera/device_enumerator.cpp                |  2 +-\n src/libcamera/device_enumerator_udev.cpp           |  2 +-\n src/libcamera/formats.cpp                          |  2 +-\n src/libcamera/media_device.cpp                     | 14 +++++++-------\n src/libcamera/pipeline_handler.cpp                 |  2 +-\n src/libcamera/pixel_format.cpp                     |  2 +-\n src/libcamera/sensor/camera_sensor_properties.cpp  |  4 ++--\n src/libcamera/v4l2_subdevice.cpp                   |  2 +-\n src/libcamera/v4l2_videodevice.cpp                 |  2 +-\n src/py/libcamera/py_camera_manager.h               |  2 +-\n src/py/libcamera/py_main.cpp                       |  2 +-\n 31 files changed, 66 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\nindex 780aeda6a..3b8b3dea9 100644\n--- a/include/libcamera/base/utils.h\n+++ b/include/libcamera/base/utils.h\n@@ -38,7 +38,7 @@ namespace utils {\n const char *basename(const char *path);\n \n char *secure_getenv(const char *name);\n-std::string dirname(const std::string &path);\n+std::string dirname(std::string_view path);\n \n template<typename T>\n std::vector<typename T::key_type> map_keys(const T &map)\n@@ -143,7 +143,7 @@ size_t strlcpy(char *dst, const char *src, size_t size);\n \n #ifndef __DOXYGEN__\n template<typename Container, typename UnaryOp>\n-std::string join(const Container &items, const std::string &sep, UnaryOp op)\n+std::string join(const Container &items, std::string_view sep, UnaryOp op)\n {\n \tstd::ostringstream ss;\n \tbool first = true;\n@@ -162,7 +162,7 @@ std::string join(const Container &items, const std::string &sep, UnaryOp op)\n }\n \n template<typename Container>\n-std::string join(const Container &items, const std::string &sep)\n+std::string join(const Container &items, std::string_view sep)\n {\n \tstd::ostringstream ss;\n \tbool first = true;\n@@ -181,7 +181,7 @@ std::string join(const Container &items, const std::string &sep)\n }\n #else\n template<typename Container, typename UnaryOp>\n-std::string join(const Container &items, const std::string &sep, UnaryOp op = nullptr);\n+std::string join(const Container &items, std::string_view sep, UnaryOp op = nullptr);\n #endif\n \n namespace details {\n@@ -240,7 +240,7 @@ private:\n \n details::StringSplitter split(const std::string &str, const std::string &delim);\n \n-std::string toAscii(const std::string &str);\n+std::string toAscii(std::string_view str);\n \n std::string libcameraBuildPath();\n std::string libcameraSourcePath();\ndiff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h\nindex b50df7825..27835500f 100644\n--- a/include/libcamera/camera_manager.h\n+++ b/include/libcamera/camera_manager.h\n@@ -9,6 +9,7 @@\n \n #include <memory>\n #include <string>\n+#include <string_view>\n #include <sys/types.h>\n #include <vector>\n \n@@ -31,7 +32,7 @@ public:\n \tvoid stop();\n \n \tstd::vector<std::shared_ptr<Camera>> cameras() const;\n-\tstd::shared_ptr<Camera> get(const std::string &id);\n+\tstd::shared_ptr<Camera> get(std::string_view id);\n \n \tstatic const std::string &version() { return version_; }\n \ndiff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\nindex d7d4dab62..b44093906 100644\n--- a/include/libcamera/internal/camera_sensor_properties.h\n+++ b/include/libcamera/internal/camera_sensor_properties.h\n@@ -9,7 +9,7 @@\n \n #include <map>\n #include <stdint.h>\n-#include <string>\n+#include <string_view>\n \n #include <libcamera/control_ids.h>\n #include <libcamera/geometry.h>\n@@ -24,7 +24,7 @@ struct CameraSensorProperties {\n \t\tuint8_t hblankDelay;\n \t};\n \n-\tstatic const CameraSensorProperties *get(const std::string &sensor);\n+\tstatic const CameraSensorProperties *get(std::string_view sensor);\n \n \tSize unitCellSize;\n \tstd::map<controls::draft::TestPatternModeEnum, int32_t> testPatternModes;\ndiff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h\nindex db3532a98..eecc39cfb 100644\n--- a/include/libcamera/internal/device_enumerator.h\n+++ b/include/libcamera/internal/device_enumerator.h\n@@ -9,6 +9,7 @@\n \n #include <memory>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/base/signal.h>\n@@ -48,7 +49,7 @@ public:\n protected:\n \tstd::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode);\n \tvoid addDevice(std::unique_ptr<MediaDevice> media);\n-\tvoid removeDevice(const std::string &deviceNode);\n+\tvoid removeDevice(std::string_view deviceNode);\n \n private:\n \tstd::vector<std::shared_ptr<MediaDevice>> devices_;\ndiff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h\nindex 6a3e9c16a..bd7ac6ed1 100644\n--- a/include/libcamera/internal/formats.h\n+++ b/include/libcamera/internal/formats.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <array>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/geometry.h>\n@@ -35,7 +36,7 @@ public:\n \n \tstatic const PixelFormatInfo &info(const PixelFormat &format);\n \tstatic const PixelFormatInfo &info(const V4L2PixelFormat &format);\n-\tstatic const PixelFormatInfo &info(const std::string &name);\n+\tstatic const PixelFormatInfo &info(std::string_view name);\n \n \tunsigned int stride(unsigned int width, unsigned int plane,\n \t\t\t    unsigned int align = 1) const;\ndiff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex e412d3a0b..91610a7aa 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -9,6 +9,7 @@\n \n #include <map>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <linux/media.h>\n@@ -44,10 +45,10 @@ public:\n \tunsigned int hwRevision() const { return hwRevision_; }\n \n \tconst std::vector<MediaEntity *> &entities() const { return entities_; }\n-\tMediaEntity *getEntityByName(const std::string &name) const;\n+\tMediaEntity *getEntityByName(std::string_view name) const;\n \n-\tMediaLink *link(const std::string &sourceName, unsigned int sourceIdx,\n-\t\t\tconst std::string &sinkName, unsigned int sinkIdx);\n+\tMediaLink *link(std::string_view sourceName, unsigned int sourceIdx,\n+\t\t\tstd::string_view sinkName, unsigned int sinkIdx);\n \tMediaLink *link(const MediaEntity *source, unsigned int sourceIdx,\n \t\t\tconst MediaEntity *sink, unsigned int sinkIdx);\n \tMediaLink *link(const MediaPad *source, const MediaPad *sink);\ndiff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h\nindex fb28a18d0..45eafce9b 100644\n--- a/include/libcamera/internal/pipeline_handler.h\n+++ b/include/libcamera/internal/pipeline_handler.h\n@@ -10,6 +10,7 @@\n #include <memory>\n #include <queue>\n #include <string>\n+#include <string_view>\n #include <sys/types.h>\n #include <vector>\n \n@@ -112,7 +113,7 @@ public:\n \tconst std::string &name() const { return name_; }\n \n \tstatic std::vector<PipelineHandlerFactoryBase *> &factories();\n-\tstatic const PipelineHandlerFactoryBase *getFactoryByName(const std::string &name);\n+\tstatic const PipelineHandlerFactoryBase *getFactoryByName(std::string_view name);\n \n private:\n \tstatic void registerType(PipelineHandlerFactoryBase *factory);\ndiff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h\nindex 194382f84..d17365e14 100644\n--- a/include/libcamera/internal/v4l2_subdevice.h\n+++ b/include/libcamera/internal/v4l2_subdevice.h\n@@ -11,6 +11,7 @@\n #include <optional>\n #include <ostream>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <linux/v4l2-subdev.h>\n@@ -161,7 +162,7 @@ public:\n \tconst V4L2SubdeviceCapability &caps() const { return caps_; }\n \n \tstatic std::unique_ptr<V4L2Subdevice>\n-\tfromEntityName(const MediaDevice *media, const std::string &entity);\n+\tfromEntityName(const MediaDevice *media, std::string_view entity);\n \n protected:\n \tstd::string logPrefix() const override;\ndiff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex f021c2a01..c256e82af 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -14,6 +14,7 @@\n #include <ostream>\n #include <stdint.h>\n #include <string>\n+#include <string_view>\n #include <unordered_set>\n #include <vector>\n \n@@ -228,7 +229,7 @@ public:\n \tSignal<> dequeueTimeout;\n \n \tstatic std::unique_ptr<V4L2VideoDevice>\n-\tfromEntityName(const MediaDevice *media, const std::string &entity);\n+\tfromEntityName(const MediaDevice *media, std::string_view entity);\n \n \tV4L2PixelFormat toV4L2PixelFormat(const PixelFormat &pixelFormat) const;\n \ndiff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h\nindex 1b4d8c7c8..874b2528b 100644\n--- a/include/libcamera/pixel_format.h\n+++ b/include/libcamera/pixel_format.h\n@@ -10,6 +10,7 @@\n #include <ostream>\n #include <stdint.h>\n #include <string>\n+#include <string_view>\n \n namespace libcamera {\n \n@@ -38,7 +39,7 @@ public:\n \n \tstd::string toString() const;\n \n-\tstatic PixelFormat fromString(const std::string &name);\n+\tstatic PixelFormat fromString(std::string_view name);\n \n private:\n \tuint32_t fourcc_;\ndiff --git a/src/apps/cam/capture_script.cpp b/src/apps/cam/capture_script.cpp\nindex fc1dfa75f..d4760ea78 100644\n--- a/src/apps/cam/capture_script.cpp\n+++ b/src/apps/cam/capture_script.cpp\n@@ -432,7 +432,7 @@ std::vector<std::string> CaptureScript::parseSingleArray()\n \t}\n }\n \n-void CaptureScript::unpackFailure(const ControlId *id, const std::string &repr)\n+void CaptureScript::unpackFailure(const ControlId *id, std::string_view repr)\n {\n \tstatic const std::map<unsigned int, const char *> typeNames = {\n \t\t{ ControlTypeNone, \"none\" },\ndiff --git a/src/apps/cam/capture_script.h b/src/apps/cam/capture_script.h\nindex 294b92036..fb40371f2 100644\n--- a/src/apps/cam/capture_script.h\n+++ b/src/apps/cam/capture_script.h\n@@ -10,6 +10,7 @@\n #include <map>\n #include <memory>\n #include <string>\n+#include <string_view>\n \n #include <libcamera/camera.h>\n #include <libcamera/controls.h>\n@@ -67,7 +68,7 @@ private:\n \tstd::vector<std::string> parseSingleArray();\n \n \tvoid unpackFailure(const libcamera::ControlId *id,\n-\t\t\t   const std::string &repr);\n+\t\t\t   std::string_view repr);\n \tlibcamera::ControlValue unpackControl(const libcamera::ControlId *id);\n \tlibcamera::Rectangle unpackRectangle(const std::vector<std::string> &strVec);\n };\ndiff --git a/src/apps/cam/drm.cpp b/src/apps/cam/drm.cpp\nindex 47bbb6b05..fd9c59ec4 100644\n--- a/src/apps/cam/drm.cpp\n+++ b/src/apps/cam/drm.cpp\n@@ -57,7 +57,7 @@ Object::~Object()\n {\n }\n \n-const Property *Object::property(const std::string &name) const\n+const Property *Object::property(std::string_view name) const\n {\n \tfor (const PropertyValue &pv : properties_) {\n \t\tconst Property *property = static_cast<const Property *>(dev_->object(pv.id()));\n@@ -68,7 +68,7 @@ const Property *Object::property(const std::string &name) const\n \treturn nullptr;\n }\n \n-const PropertyValue *Object::propertyValue(const std::string &name) const\n+const PropertyValue *Object::propertyValue(std::string_view name) const\n {\n \tfor (const PropertyValue &pv : properties_) {\n \t\tconst Property *property = static_cast<const Property *>(dev_->object(pv.id()));\n@@ -320,7 +320,7 @@ AtomicRequest::~AtomicRequest()\n \t\tdrmModeAtomicFree(request_);\n }\n \n-int AtomicRequest::addProperty(const Object *object, const std::string &property,\n+int AtomicRequest::addProperty(const Object *object, std::string_view property,\n \t\t\t       uint64_t value)\n {\n \tif (!valid_)\n@@ -335,7 +335,7 @@ int AtomicRequest::addProperty(const Object *object, const std::string &property\n \treturn addProperty(object->id(), prop->id(), value);\n }\n \n-int AtomicRequest::addProperty(const Object *object, const std::string &property,\n+int AtomicRequest::addProperty(const Object *object, std::string_view property,\n \t\t\t       std::unique_ptr<Blob> blob)\n {\n \tif (!valid_)\ndiff --git a/src/apps/cam/drm.h b/src/apps/cam/drm.h\nindex 1ba83b6eb..aa1b06400 100644\n--- a/src/apps/cam/drm.h\n+++ b/src/apps/cam/drm.h\n@@ -13,6 +13,7 @@\n #include <memory>\n #include <stdint.h>\n #include <string>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/base/signal.h>\n@@ -57,8 +58,8 @@ public:\n \tuint32_t id() const { return id_; }\n \tType type() const { return type_; }\n \n-\tconst Property *property(const std::string &name) const;\n-\tconst PropertyValue *propertyValue(const std::string &name) const;\n+\tconst Property *property(std::string_view name) const;\n+\tconst PropertyValue *propertyValue(std::string_view name) const;\n \tconst std::vector<PropertyValue> &properties() const { return properties_; }\n \n protected:\n@@ -260,9 +261,9 @@ public:\n \tDevice *device() const { return dev_; }\n \tbool isValid() const { return valid_; }\n \n-\tint addProperty(const Object *object, const std::string &property,\n+\tint addProperty(const Object *object, std::string_view property,\n \t\t\tuint64_t value);\n-\tint addProperty(const Object *object, const std::string &property,\n+\tint addProperty(const Object *object, std::string_view property,\n \t\t\tstd::unique_ptr<Blob> blob);\n \tint commit(unsigned int flags = 0);\n \ndiff --git a/src/ipa/libipa/camera_sensor_helper.cpp b/src/ipa/libipa/camera_sensor_helper.cpp\nindex 7c66cd57d..4ed050b14 100644\n--- a/src/ipa/libipa/camera_sensor_helper.cpp\n+++ b/src/ipa/libipa/camera_sensor_helper.cpp\n@@ -240,7 +240,7 @@ CameraSensorHelperFactoryBase::CameraSensorHelperFactoryBase(const std::string n\n  * corresponding to the named factory or a null pointer if no such factory\n  * exists\n  */\n-std::unique_ptr<CameraSensorHelper> CameraSensorHelperFactoryBase::create(const std::string &name)\n+std::unique_ptr<CameraSensorHelper> CameraSensorHelperFactoryBase::create(std::string_view name)\n {\n \tconst std::vector<CameraSensorHelperFactoryBase *> &factories =\n \t\tCameraSensorHelperFactoryBase::factories();\ndiff --git a/src/ipa/libipa/camera_sensor_helper.h b/src/ipa/libipa/camera_sensor_helper.h\nindex a9300a64f..eedc80114 100644\n--- a/src/ipa/libipa/camera_sensor_helper.h\n+++ b/src/ipa/libipa/camera_sensor_helper.h\n@@ -11,6 +11,7 @@\n #include <optional>\n #include <stdint.h>\n #include <string>\n+#include <string_view>\n #include <variant>\n #include <vector>\n \n@@ -56,7 +57,7 @@ public:\n \tCameraSensorHelperFactoryBase(const std::string name);\n \tvirtual ~CameraSensorHelperFactoryBase() = default;\n \n-\tstatic std::unique_ptr<CameraSensorHelper> create(const std::string &name);\n+\tstatic std::unique_ptr<CameraSensorHelper> create(std::string_view name);\n \n \tstatic std::vector<CameraSensorHelperFactoryBase *> &factories();\n \ndiff --git a/src/ipa/libipa/module.cpp b/src/ipa/libipa/module.cpp\nindex 64ca91419..91fb588e7 100644\n--- a/src/ipa/libipa/module.cpp\n+++ b/src/ipa/libipa/module.cpp\n@@ -107,7 +107,7 @@ namespace ipa {\n  */\n \n /**\n- * \\fn Module::createAlgorithm(const std::string &name)\n+ * \\fn Module::createAlgorithm(std::string_view name)\n  * \\brief Create an instance of an Algorithm by name\n  * \\param[in] name The algorithm name\n  *\ndiff --git a/src/ipa/libipa/module.h b/src/ipa/libipa/module.h\nindex 0fb51916f..62c700a64 100644\n--- a/src/ipa/libipa/module.h\n+++ b/src/ipa/libipa/module.h\n@@ -9,7 +9,7 @@\n \n #include <list>\n #include <memory>\n-#include <string>\n+#include <string_view>\n #include <vector>\n \n #include <libcamera/base/log.h>\n@@ -95,7 +95,7 @@ private:\n \t\treturn 0;\n \t}\n \n-\tstatic std::unique_ptr<Algorithm<Module>> createAlgorithm(const std::string &name)\n+\tstatic std::unique_ptr<Algorithm<Module>> createAlgorithm(std::string_view name)\n \t{\n \t\tfor (const AlgorithmFactoryBase<Module> *factory : factories()) {\n \t\t\tif (factory->name() == name)\ndiff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp\nindex bcfc1941a..de6e2afd6 100644\n--- a/src/libcamera/base/utils.cpp\n+++ b/src/libcamera/base/utils.cpp\n@@ -80,7 +80,7 @@ char *secure_getenv(const char *name)\n  *\n  * \\return A string of the directory component of the path\n  */\n-std::string dirname(const std::string &path)\n+std::string dirname(std::string_view path)\n {\n \tif (path.empty())\n \t\treturn \".\";\n@@ -116,7 +116,7 @@ std::string dirname(const std::string &path)\n \t\tpos--;\n \t}\n \n-\treturn path.substr(0, pos + 1);\n+\treturn std::string(path.substr(0, pos + 1));\n }\n \n /**\n@@ -278,7 +278,7 @@ std::string details::StringSplitter::iterator::operator*() const\n \n /**\n  * \\fn template<typename Container, typename UnaryOp> \\\n- * std::string utils::join(const Container &items, const std::string &sep, UnaryOp op)\n+ * std::string utils::join(const Container &items, std::string_view sep, UnaryOp op)\n  * \\brief Join elements of a container in a string with a separator\n  * \\param[in] items The container\n  * \\param[in] sep The separator to add between elements\n@@ -319,7 +319,7 @@ details::StringSplitter split(const std::string &str, const std::string &delim)\n  *\n  * \\return A string equal to \\a str stripped out of all non-ASCII characters\n  */\n-std::string toAscii(const std::string &str)\n+std::string toAscii(std::string_view str)\n {\n \tstd::string ret;\n \tfor (const char &c : str)\ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex 87e6717ec..179fa37ea 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -382,7 +382,7 @@ std::vector<std::shared_ptr<Camera>> CameraManager::cameras() const\n  *\n  * \\return Shared pointer to Camera object or nullptr if camera not found\n  */\n-std::shared_ptr<Camera> CameraManager::get(const std::string &id)\n+std::shared_ptr<Camera> CameraManager::get(std::string_view id)\n {\n \tPrivate *const d = _d();\n \ndiff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\nindex ae17862f6..8744a90f3 100644\n--- a/src/libcamera/device_enumerator.cpp\n+++ b/src/libcamera/device_enumerator.cpp\n@@ -272,7 +272,7 @@ void DeviceEnumerator::addDevice(std::unique_ptr<MediaDevice> media)\n  * enumerator with addDevice(). The media device's MediaDevice::disconnected\n  * signal is emitted.\n  */\n-void DeviceEnumerator::removeDevice(const std::string &deviceNode)\n+void DeviceEnumerator::removeDevice(std::string_view deviceNode)\n {\n \tstd::shared_ptr<MediaDevice> media;\n \ndiff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\nindex 4e20a3cc0..c330f30bc 100644\n--- a/src/libcamera/device_enumerator_udev.cpp\n+++ b/src/libcamera/device_enumerator_udev.cpp\n@@ -351,7 +351,7 @@ void DeviceEnumeratorUdev::udevNotify()\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(std::string(deviceNode));\n+\t\t\tremoveDevice(deviceNode);\n \t}\n \n \tudev_device_unref(dev);\ndiff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\nindex bfcdfc089..112dfe66b 100644\n--- a/src/libcamera/formats.cpp\n+++ b/src/libcamera/formats.cpp\n@@ -1037,7 +1037,7 @@ const PixelFormatInfo &PixelFormatInfo::info(const V4L2PixelFormat &format)\n  * \\return The PixelFormatInfo describing the PixelFormat matching the\n  * \\a name if known, or an invalid PixelFormatInfo otherwise\n  */\n-const PixelFormatInfo &PixelFormatInfo::info(const std::string &name)\n+const PixelFormatInfo &PixelFormatInfo::info(std::string_view name)\n {\n \tfor (const auto &info : pixelFormatInfo) {\n \t\tif (info.second.name == name)\ndiff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp\nindex d71dad74d..131b34446 100644\n--- a/src/libcamera/media_device.cpp\n+++ b/src/libcamera/media_device.cpp\n@@ -331,7 +331,7 @@ done:\n  * \\param[in] name The entity name\n  * \\return The entity with \\a name, or nullptr if no such entity is found\n  */\n-MediaEntity *MediaDevice::getEntityByName(const std::string &name) const\n+MediaEntity *MediaDevice::getEntityByName(std::string_view name) const\n {\n \tfor (MediaEntity *e : entities_)\n \t\tif (e->name() == name)\n@@ -359,8 +359,8 @@ MediaEntity *MediaDevice::getEntityByName(const std::string &name) const\n  * \\return The link that connects the two pads, or nullptr if no such a link\n  * exists\n  */\n-MediaLink *MediaDevice::link(const std::string &sourceName, unsigned int sourceIdx,\n-\t\t\t     const std::string &sinkName, unsigned int sinkIdx)\n+MediaLink *MediaDevice::link(std::string_view sourceName, unsigned int sourceIdx,\n+\t\t\t     std::string_view sinkName, unsigned int sinkIdx)\n {\n \tconst MediaEntity *source = getEntityByName(sourceName);\n \tconst MediaEntity *sink = getEntityByName(sinkName);\n@@ -382,8 +382,8 @@ MediaLink *MediaDevice::link(const std::string &sourceName, unsigned int sourceI\n  * entity \\a source, to the pad at index \\a sinkIdx of the sink entity \\a\n  * sink, if any.\n  *\n- * \\sa link(const std::string &sourceName, unsigned int sourceIdx,\n- *          const std::string &sinkName, unsigned int sinkIdx)\n+ * \\sa link(std::string_view sourceName, unsigned int sourceIdx,\n+ *          std::string_view sinkName, unsigned int sinkIdx)\n  * \\sa link(const MediaPad *source, const MediaPad *sink)\n  *\n  * \\return The link that connects the two pads, or nullptr if no such a link\n@@ -406,8 +406,8 @@ MediaLink *MediaDevice::link(const MediaEntity *source, unsigned int sourceIdx,\n  * \\param[in] source The source pad\n  * \\param[in] sink The sink pad\n  *\n- * \\sa link(const std::string &sourceName, unsigned int sourceIdx,\n- *          const std::string &sinkName, unsigned int sinkIdx)\n+ * \\sa link(std::string_view sourceName, unsigned int sourceIdx,\n+ *          std::string_view sinkName, unsigned int sinkIdx)\n  * \\sa link(const MediaEntity *source, unsigned int sourceIdx,\n  *          const MediaEntity *sink, unsigned int sinkIdx)\n  *\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex caa5c20e7..6b395c666 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -852,7 +852,7 @@ std::vector<PipelineHandlerFactoryBase *> &PipelineHandlerFactoryBase::factories\n  * \\param[in] name The pipeline handler name\n  * \\return The factory of the pipeline with name \\a name, or nullptr if not found\n  */\n-const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(const std::string &name)\n+const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(std::string_view name)\n {\n \tconst std::vector<PipelineHandlerFactoryBase *> &factories =\n \t\tPipelineHandlerFactoryBase::factories();\ndiff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp\nindex 314179a81..22f1520fd 100644\n--- a/src/libcamera/pixel_format.cpp\n+++ b/src/libcamera/pixel_format.cpp\n@@ -135,7 +135,7 @@ std::string PixelFormat::toString() const\n  * \\return The PixelFormat represented by the \\a name if known, or an\n  * invalid pixel format otherwise.\n  */\n-PixelFormat PixelFormat::fromString(const std::string &name)\n+PixelFormat PixelFormat::fromString(std::string_view name)\n {\n \treturn PixelFormatInfo::info(name).format;\n }\ndiff --git a/src/libcamera/sensor/camera_sensor_properties.cpp b/src/libcamera/sensor/camera_sensor_properties.cpp\nindex 2b06c5a1a..4283cacfa 100644\n--- a/src/libcamera/sensor/camera_sensor_properties.cpp\n+++ b/src/libcamera/sensor/camera_sensor_properties.cpp\n@@ -78,9 +78,9 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)\n  * \\return A pointer to the CameraSensorProperties instance associated with a sensor\n  * or nullptr if the sensor is not supported\n  */\n-const CameraSensorProperties *CameraSensorProperties::get(const std::string &sensor)\n+const CameraSensorProperties *CameraSensorProperties::get(std::string_view sensor)\n {\n-\tstatic const std::map<std::string, const CameraSensorProperties> sensorProps = {\n+\tstatic const std::map<std::string_view, const CameraSensorProperties> sensorProps = {\n \t\t{ \"ar0144\", {\n \t\t\t.unitCellSize = { 3000, 3000 },\n \t\t\t.testPatternModes = {\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 3a0d075f9..7e85b33be 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -1688,7 +1688,7 @@ const std::string &V4L2Subdevice::model()\n  */\n std::unique_ptr<V4L2Subdevice>\n V4L2Subdevice::fromEntityName(const MediaDevice *media,\n-\t\t\t      const std::string &entity)\n+\t\t\t      std::string_view entity)\n {\n \tMediaEntity *mediaEntity = media->getEntityByName(entity);\n \tif (!mediaEntity)\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex a5cf67845..834a1bd0d 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -2077,7 +2077,7 @@ void V4L2VideoDevice::watchdogExpired()\n  */\n std::unique_ptr<V4L2VideoDevice>\n V4L2VideoDevice::fromEntityName(const MediaDevice *media,\n-\t\t\t\tconst std::string &entity)\n+\t\t\t\tstd::string_view entity)\n {\n \tMediaEntity *mediaEntity = media->getEntityByName(entity);\n \tif (!mediaEntity)\ndiff --git a/src/py/libcamera/py_camera_manager.h b/src/py/libcamera/py_camera_manager.h\nindex 3574db236..af69b915e 100644\n--- a/src/py/libcamera/py_camera_manager.h\n+++ b/src/py/libcamera/py_camera_manager.h\n@@ -20,7 +20,7 @@ public:\n \t~PyCameraManager();\n \n \tpybind11::list cameras();\n-\tstd::shared_ptr<Camera> get(const std::string &name) { return cameraManager_->get(name); }\n+\tstd::shared_ptr<Camera> get(std::string_view name) { return cameraManager_->get(name); }\n \n \tstatic const std::string &version() { return CameraManager::version(); }\n \ndiff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp\nindex 441a70ab4..820768c24 100644\n--- a/src/py/libcamera/py_main.cpp\n+++ b/src/py/libcamera/py_main.cpp\n@@ -510,7 +510,7 @@ PYBIND11_MODULE(_libcamera, m)\n \tpyPixelFormat\n \t\t.def(py::init<>())\n \t\t.def(py::init<uint32_t, uint64_t>())\n-\t\t.def(py::init<>([](const std::string &str) {\n+\t\t.def(py::init<>([](std::string_view str) {\n \t\t\treturn PixelFormat::fromString(str);\n \t\t}))\n \t\t.def_property_readonly(\"fourcc\", &PixelFormat::fourcc)\n",
    "prefixes": [
        "RFC",
        "v1"
    ]
}