{"id":16064,"url":"https://patchwork.libcamera.org/api/1.1/patches/16064/?format=json","web_url":"https://patchwork.libcamera.org/patch/16064/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220526133052.18791-1-laurent.pinchart@ideasonboard.com>","date":"2022-05-26T13:30:52","name":"[libcamera-devel] libcamera: media_device: Return string references to avoid copies","commit_ref":"7d1f03e5baaa783eeb0587bbbf319eacc1383ab7","pull_url":null,"state":"accepted","archived":false,"hash":"2103c094a9efdffb98da7b9e20902012220675d8","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16064/mbox/","series":[{"id":3144,"url":"https://patchwork.libcamera.org/api/1.1/series/3144/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3144","date":"2022-05-26T13:30:52","name":"[libcamera-devel] libcamera: media_device: Return string references to avoid copies","version":1,"mbox":"https://patchwork.libcamera.org/series/3144/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16064/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16064/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 BB3BABD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 May 2022 13:31:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 780DC611C0;\n\tThu, 26 May 2022 15:31:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B3DE860DB0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 May 2022 15:31:01 +0200 (CEST)","from pendragon.lan (unknown [37.120.212.14])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3E8C46D4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 May 2022 15:31:01 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653571863;\n\tbh=3mRS+cQGJB7tb/A1GfWTWfgbA6TA0PeLvmQgN4P5+vk=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=XzrykqD4Uunb2WdXDg84g1c8Wb6ebRL+biNsg/lNlYyAW/YANypp2VKjMGlFxqkZA\n\tHQTF7D9G0m5byw3fe9ZBYY8SIC/4WgRswC8adwH46PZ/Yv643YFKWBhhsuZtA8Abe/\n\t5mgnf9fMmUmcPMHX3BOld8SjWqJkLlnZ0RVzToLuBQ5+XO9mWvfOUXuPb3Byj4PwJe\n\tt80M9/dZXYL3upDVoKG8uUCaEgrgpSX2RiYuAQx/sEskuMR8bRaUAoBhToxzm3inIo\n\toMuCl27A1j8VnEevWk9Sq1pRX/hhH0KRgx7GoH6rJLCjH9IkC0dycMA7eah6+uXMN1\n\tj1v3ZLdr+BcdQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653571861;\n\tbh=3mRS+cQGJB7tb/A1GfWTWfgbA6TA0PeLvmQgN4P5+vk=;\n\th=From:To:Subject:Date:From;\n\tb=Tj8WCz7jAD0EdhxjSQcWx+sDqszjFe6IAO8yDvp/FuLJInXqi8msvWp8lhtsbPO4/\n\t6n6GMDpVWGkudYAynPCnEhP4uyIksR11oaQExInKEkVlMk+4/6Q0+ymvu6g0iWeK7V\n\thfuF1aqeygdk/aLqdIf9g+LoJEuom3T4nsX4oOcc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Tj8WCz7j\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 26 May 2022 16:30:52 +0300","Message-Id":"<20220526133052.18791-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.35.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: media_device: Return string\n\treferences to avoid copies","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The MediaDevice::driver(), deviceNode() and model() functions return a\nconst std::string, copying the string stored internally in the class.\nReturn references instead to avoid copies.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/media_device.h | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\n\nbase-commit: f8e4649680303ce9b7dace5ad1344fcb450013ac","diff":"diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h\nindex 6e2a63f38229..eb8cfde48e20 100644\n--- a/include/libcamera/internal/media_device.h\n+++ b/include/libcamera/internal/media_device.h\n@@ -38,9 +38,9 @@ public:\n \tint populate();\n \tbool isValid() const { return valid_; }\n \n-\tconst std::string driver() const { return driver_; }\n-\tconst std::string deviceNode() const { return deviceNode_; }\n-\tconst std::string model() const { return model_; }\n+\tconst std::string &driver() const { return driver_; }\n+\tconst std::string &deviceNode() const { return deviceNode_; }\n+\tconst std::string &model() const { return model_; }\n \tunsigned int version() const { return version_; }\n \tunsigned int hwRevision() const { return hwRevision_; }\n \n","prefixes":["libcamera-devel"]}