[{"id":33159,"web_url":"https://patchwork.libcamera.org/comment/33159/","msgid":"<20250124162235.GB13689@pendragon.ideasonboard.com>","date":"2025-01-24T16:22:35","subject":"Re: [RFC PATCH v1 1/7] libcamera: base: log: Move all fields of\n\t`LogMessage`","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Tue, Jan 21, 2025 at 06:50:52PM +0000, Barnabás Pőcze wrote:\n> Move all fields of `LogMessage` in the move constructor.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nbut given that C++17 enforces copy elision, I think we could drop this\nfunction completely (see the comment just above it).\n\n> ---\n>  src/libcamera/base/log.cpp | 6 ++++--\n>  1 file changed, 4 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp\n> index 3a656b8f0..61a43d525 100644\n> --- a/src/libcamera/base/log.cpp\n> +++ b/src/libcamera/base/log.cpp\n> @@ -17,6 +17,7 @@\n>  #include <syslog.h>\n>  #include <time.h>\n>  #include <unordered_set>\n> +#include <utility>\n>  \n>  #include <libcamera/logging.h>\n>  \n> @@ -894,9 +895,10 @@ LogMessage::LogMessage(const char *fileName, unsigned int line,\n>   */\n>  LogMessage::LogMessage(LogMessage &&other)\n>  \t: msgStream_(std::move(other.msgStream_)), category_(other.category_),\n> -\t  severity_(other.severity_)\n> +\t  severity_(std::exchange(other.severity_, LogInvalid)),\n> +\t  timestamp_(other.timestamp_), fileInfo_(std::move(other.fileInfo_)),\n> +\t  prefix_(std::move(other.prefix_))\n>  {\n> -\tother.severity_ = LogInvalid;\n>  }\n>  \n>  void LogMessage::init(const char *fileName, unsigned int line)","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 CF5F0C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jan 2025 16:22:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 090C46855D;\n\tFri, 24 Jan 2025 17:22:48 +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 034C868556\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jan 2025 17:22:45 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E16321C;\n\tFri, 24 Jan 2025 17:21:41 +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=\"lC7jwVNk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737735701;\n\tbh=YjO08P2hbid9SZtWcTETA4KNepe/mq3ZiemfmJ53P4M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lC7jwVNkzT7eMIRqIPBRZszMMJq1eMCw6bp//jBHfSIhF8yT17ZrXv67Fi3x3nrxZ\n\tF21ghcuZQmzSIUg5QjuTdw2cU4SMYRO57ICaL1OxDVZlc/fY9dvchEWCyFuMfxsK/d\n\t/RCvyVaAV08we0h7KtaQ7c8vt6VcC/yPuejm0qms=","Date":"Fri, 24 Jan 2025 18:22:35 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 1/7] libcamera: base: log: Move all fields of\n\t`LogMessage`","Message-ID":"<20250124162235.GB13689@pendragon.ideasonboard.com>","References":"<20250121185044.300816-1-pobrn@protonmail.com>\n\t<20250121185044.300816-2-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250121185044.300816-2-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>"}}]