[{"id":32748,"web_url":"https://patchwork.libcamera.org/comment/32748/","msgid":"<Z1_Nixc1dE93L3ub@pyrite.rasen.tech>","date":"2024-12-16T06:49:47","subject":"Re: [PATCH] libcamera: yaml_parser: Improve efficiency of string\n\tempty check","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Mon, Dec 16, 2024 at 12:39:47AM +0200, Laurent Pinchart wrote:\n> Comparing a std::string to an empty string literal is more complex than\n> using the std::string::empty() function. Improve the code efficiency by\n> replacing the former with the latter.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/libcamera/yaml_parser.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> index 5ca5fb8235b5e761..a5e424615c263f2d 100644\n> --- a/src/libcamera/yaml_parser.cpp\n> +++ b/src/libcamera/yaml_parser.cpp\n> @@ -194,7 +194,7 @@ YamlObject::Getter<double>::get(const YamlObject &obj) const\n>  \tif (obj.type_ != Type::Value)\n>  \t\treturn std::nullopt;\n>  \n> -\tif (obj.value_ == \"\")\n> +\tif (obj.value_.empty())\n>  \t\treturn std::nullopt;\n>  \n>  \tchar *end;\n> \n> base-commit: 8e15010b7dfa9c2a68dd57f924b5603784be0e09","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 48A9DC32F9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 06:49:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2751567F37;\n\tMon, 16 Dec 2024 07:49:58 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6ED9A62C8A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 07:49:56 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:c11a:e451:861f:3d32])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id F0BD322F;\n\tMon, 16 Dec 2024 07:49:18 +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=\"KcaUwoUj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734331760;\n\tbh=Z74p8Sa1MWHQhVUvvll3pQvfMJ04KBJ8LIf6Bz9XtPU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=KcaUwoUjprxGkphKFU4ASzVwVGMNxuf5gVdQdrGTz2eVIsXRw+fgZIf1piuxt3ILT\n\tan5NZICU1608TIF7bQCF+Gw1HZlUqIEtOcwf0Lup+MpSqM5lFkX+uzlC1/+QbFSssT\n\t+7V4C/u6vzq/1grIVuboqlSipd1/nohVUTHhUH28=","Date":"Mon, 16 Dec 2024 15:49:47 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] libcamera: yaml_parser: Improve efficiency of string\n\tempty check","Message-ID":"<Z1_Nixc1dE93L3ub@pyrite.rasen.tech>","References":"<20241215223947.7779-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20241215223947.7779-1-laurent.pinchart@ideasonboard.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>"}},{"id":32768,"web_url":"https://patchwork.libcamera.org/comment/32768/","msgid":"<173435170415.253066.15516907888139096143@ping.linuxembedded.co.uk>","date":"2024-12-16T12:21:44","subject":"Re: [PATCH] libcamera: yaml_parser: Improve efficiency of string\n\tempty check","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Paul Elder (2024-12-16 06:49:47)\n> On Mon, Dec 16, 2024 at 12:39:47AM +0200, Laurent Pinchart wrote:\n> > Comparing a std::string to an empty string literal is more complex than\n> > using the std::string::empty() function. Improve the code efficiency by\n> > replacing the former with the latter.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > ---\n> >  src/libcamera/yaml_parser.cpp | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> > \n> > diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\n> > index 5ca5fb8235b5e761..a5e424615c263f2d 100644\n> > --- a/src/libcamera/yaml_parser.cpp\n> > +++ b/src/libcamera/yaml_parser.cpp\n> > @@ -194,7 +194,7 @@ YamlObject::Getter<double>::get(const YamlObject &obj) const\n> >       if (obj.type_ != Type::Value)\n> >               return std::nullopt;\n> >  \n> > -     if (obj.value_ == \"\")\n> > +     if (obj.value_.empty())\n> >               return std::nullopt;\n> >  \n> >       char *end;\n> > \n> > base-commit: 8e15010b7dfa9c2a68dd57f924b5603784be0e09","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 2E122C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Dec 2024 12:21:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE3F262C8B;\n\tMon, 16 Dec 2024 13:21:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F39B067F56\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 13:21:46 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8288113C;\n\tMon, 16 Dec 2024 13:21:10 +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=\"E7eROHQW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734351670;\n\tbh=0t8lYbMmU+m8XY91BAYALF1TWP7W6qha65Q53WoXlh8=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=E7eROHQWC1hNuqa1IwWhuXA6CSYAfYwjw2u99t1pK45ttw9bszFgj64PZnfDyh/cw\n\tfkBl70cCWVGYCGjvPVN4AMnAwoRZOuCGSjtFr6xGw7eY+otucfqe6lBLE12Ql8JV5g\n\t4e9c9Y762LbmX1lXsqdnWMo4ZRJ+kHmWDkGPE/dM=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<Z1_Nixc1dE93L3ub@pyrite.rasen.tech>","References":"<20241215223947.7779-1-laurent.pinchart@ideasonboard.com>\n\t<Z1_Nixc1dE93L3ub@pyrite.rasen.tech>","Subject":"Re: [PATCH] libcamera: yaml_parser: Improve efficiency of string\n\tempty check","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Date":"Mon, 16 Dec 2024 12:21:44 +0000","Message-ID":"<173435170415.253066.15516907888139096143@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}}]