From patchwork Thu Dec 5 09:23:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22170 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 78BA7BDB1C for ; Thu, 5 Dec 2024 09:23:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B3ECD660E4; Thu, 5 Dec 2024 10:23:07 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="MHPZAkku"; dkim-atps=neutral Received: from mail-10630.protonmail.ch (mail-10630.protonmail.ch [79.135.106.30]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DB52B618B3 for ; Thu, 5 Dec 2024 10:23:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733390584; x=1733649784; bh=/HBCYxzo/mYXXrnROpMGyNTt7kYNk/XpF633OeIROQQ=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=MHPZAkku6DbOlzt2bZFZAgkLKxoRxDoThjYEjqJbVHmWUq8hJLMDxrRW3oLoZwbfT +WB7aGrFtF//BQ8Mcy4PHjZ4XiMVNpf3F9uCse3V4JrPl2QpfmxB7It+ksyziGx7BC ZGP3gBKEA+fj2uuVuIMz3aPP5qVMSoNBWYkSJYXb6Zalq/2wlxAH05+PxnZFRmVNvA SZpbKWE7ZOVEBdPEoS+9u6wPZ4JgTo6QrrBNoUfFGNdeUNslfKq61/7eTG3B73a1pd /uCc6UmzN4diGKylk8g5jLyOCeIT/ZktT2pPOEE+wzqPUc8VJI6AGQp4xCd/pd4YDj m0OqXnw6OuVKA== Date: Thu, 05 Dec 2024 09:23:00 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v2 1/2] libcamera: utils: StringSplitter: Inline some trivial methods Message-ID: <20241205092258.1058077-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: ea303a1fe8ad60eaf8f7ea36f3cac943db67a375 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Inline some of the more trivial methods so that they can be inlined by the compiler. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- include/libcamera/base/utils.h | 17 ++++++++++++++--- src/libcamera/base/utils.cpp | 15 --------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index 957150cb..c4a06660 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -204,7 +204,11 @@ public: iterator &operator++(); std::string operator*() const; - bool operator!=(const iterator &other) const; + + bool operator!=(const iterator &other) const + { + return pos_ != other.pos_; + } private: const StringSplitter *ss_; @@ -212,8 +216,15 @@ public: std::string::size_type next_; }; - iterator begin() const; - iterator end() const; + iterator begin() const + { + return { this, 0 }; + } + + iterator end() const + { + return { this, std::string::npos }; + } private: std::string str_; diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp index 67e5a896..bcfc1941 100644 --- a/src/libcamera/base/utils.cpp +++ b/src/libcamera/base/utils.cpp @@ -276,21 +276,6 @@ std::string details::StringSplitter::iterator::operator*() const return ss_->str_.substr(pos_, count); } -bool details::StringSplitter::iterator::operator!=(const details::StringSplitter::iterator &other) const -{ - return pos_ != other.pos_; -} - -details::StringSplitter::iterator details::StringSplitter::begin() const -{ - return iterator(this, 0); -} - -details::StringSplitter::iterator details::StringSplitter::end() const -{ - return iterator(this, std::string::npos); -} - /** * \fn template \ * std::string utils::join(const Container &items, const std::string &sep, UnaryOp op) From patchwork Thu Dec 5 09:23:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22171 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B9B79BDB1C for ; Thu, 5 Dec 2024 09:23:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 602A5660EB; Thu, 5 Dec 2024 10:23:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="pXoZhVnP"; dkim-atps=neutral Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D598660E1 for ; Thu, 5 Dec 2024 10:23:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733390590; x=1733649790; bh=Px5dd2eghGhMD9W1LLrCTb99FJrWCLoaaIMWnZx3ty8=; h=Date:To:From:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=pXoZhVnPv6d1loI3EeHcKu7jbQS5ntHAwlAG4bXfjbv77qqtcGRNgJ4uzYpvdtXQ2 gRz+1N7xgwwWA6nFD4gSuCjuW9BgbuvPhgVLLkdZhk+J6Qf4gYr9kmCBpmKUBu24CC a6ZicXDPieLG+nII5dTYHSiL53T/YtQO3IBDk0sOhTFYztpgHX2XmJKpyENeFxlPPi qgj20CU5g0rh69EGLhMQ8/J4r+0mVEPdULdG1BezOITJ1nRNCAl5fyI6bELsPmQk5w 9UqM0terX189f8gmvbGPC8SmqLSeK/Yk5JEmFlTvxnK8I66QMUfzB/OuFPPEi2AEfb ksn+hA8wcO7yA== Date: Thu, 05 Dec 2024 09:23:06 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH v2 2/2] libcamera: utils: StringSplitter: Add `operator==` Message-ID: <20241205092258.1058077-2-pobrn@protonmail.com> In-Reply-To: <20241205092258.1058077-1-pobrn@protonmail.com> References: <20241205092258.1058077-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: b58a1e8768925a6c5800ad83c039c7c2b273f3dd MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" If `cpp_debugstl` is enabled in the build configuration, then libstdc++ will try to use `==` on operators in certain cases to carry out extra checks. This leads to build failures because `StringSplitter::iterator` has no `operator==`. Implement `operator==`, and express `operator!=` in terms of it. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart --- include/libcamera/base/utils.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index c4a06660..780aeda6 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -205,9 +205,14 @@ public: iterator &operator++(); std::string operator*() const; + bool operator==(const iterator &other) const + { + return pos_ == other.pos_; + } + bool operator!=(const iterator &other) const { - return pos_ != other.pos_; + return !(*this == other); } private: