[{"id":33492,"web_url":"https://patchwork.libcamera.org/comment/33492/","msgid":"<2pv6qypnqm7c6trez3lb4hhq7qqxakkv4tiqh5l2h46mpq3mhz@hckddeyhslke>","date":"2025-02-26T07:52:52","subject":"Re: [PATCH v4 6/8] libcamera: base: log: Pass dynamic prefix through","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Tue, Feb 25, 2025 at 05:36:10PM +0000, Barnabás Pőcze wrote:\n> Use move construction to essentially pass through the string\n> returned by `Loggable::logPrefix()` to avoid an unnecessary copy.\n>\n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n\n> ---\n>  include/libcamera/base/log.h | 2 +-\n>  src/libcamera/base/log.cpp   | 4 ++--\n>  2 files changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h\n> index acef24203..1fb92603f 100644\n> --- a/include/libcamera/base/log.h\n> +++ b/include/libcamera/base/log.h\n> @@ -64,7 +64,7 @@ class LogMessage\n>  public:\n>  \tLogMessage(const char *fileName, unsigned int line,\n>  \t\t   const LogCategory &category, LogSeverity severity,\n> -\t\t   const std::string &prefix = std::string());\n> +\t\t   std::string prefix = {});\n>  \t~LogMessage();\n>\n>  \tstd::ostream &stream() { return msgStream_; }\n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index c0e0be60f..6687deb93 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -858,11 +858,11 @@ const LogCategory &LogCategory::defaultCategory()\n>   */\n>  LogMessage::LogMessage(const char *fileName, unsigned int line,\n>  \t\t       const LogCategory &category, LogSeverity severity,\n> -\t\t       const std::string &prefix)\n> +\t\t       std::string prefix)\n>  \t: category_(category), severity_(severity),\n>  \t  timestamp_(utils::clock::now()),\n>  \t  fileInfo_((std::ostringstream() << utils::basename(fileName) << \":\" << line).str()),\n> -\t  prefix_(prefix)\n> +\t  prefix_(std::move(prefix))\n>  {\n>  }\n>\n> --\n> 2.48.1\n>\n>","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 0DC7CC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Feb 2025 07:52:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B904768743;\n\tWed, 26 Feb 2025 08:52:56 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A21016873F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Feb 2025 08:52:55 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0786C502;\n\tWed, 26 Feb 2025 08:51:27 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mGK55KpP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1740556288;\n\tbh=GWTMkP7zvkc0SNo/2jNRhw9qsoLibivctVG1G+yzWwI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mGK55KpPOoDSfNBZk/hxf0styalqftpOHUgvMazxNIFT/FxDDTABSPMZ3mknuuyvR\n\t8SJrz1Zh7O9QmFhCl6Oa5aHrs4i1YknAJ6UlsOrHDFpc1m9otiP3nu4frXzOY9wdUs\n\t7GUaaYVIVhcMtY8Hix7wWRKkQdN7ZQwJxH8AZB7U=","Date":"Wed, 26 Feb 2025 08:52:52 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v4 6/8] libcamera: base: log: Pass dynamic prefix through","Message-ID":"<2pv6qypnqm7c6trez3lb4hhq7qqxakkv4tiqh5l2h46mpq3mhz@hckddeyhslke>","References":"<20250225173531.2595922-1-pobrn@protonmail.com>\n\t<20250225173531.2595922-7-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250225173531.2595922-7-pobrn@protonmail.com>","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>"}}]