From patchwork Sun Dec 15 22:39:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22319 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 D0BE8C32F6 for ; Sun, 15 Dec 2024 22:40:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F1B3567F27; Sun, 15 Dec 2024 23:40:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HJPCFXlB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7231A67F1B for ; Sun, 15 Dec 2024 23:40:04 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 27ED17E9 for ; Sun, 15 Dec 2024 23:39:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1734302368; bh=pMvf5r8vkkPCU5ke1SSwMiBRVTtKplnaEa3NLi+Ig9s=; h=From:To:Subject:Date:From; b=HJPCFXlBa6txo5r86sOgxGR3aO8z5V4AyzFTpzADKkJo25HHLUnCSMGTDtMCCBj1o KVaW/NblckaTphJsI60E+fGrFLwUx7EZLoHFmEkiSe6CLoFAqjSvGgemP4ngltdpqC Qs7c7PEEWlpXNBJi4x6bpYiVfBofi8v4ibEJtwg0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] libcamera: yaml_parser: Improve efficiency of string empty check Date: Mon, 16 Dec 2024 00:39:47 +0200 Message-ID: <20241215223947.7779-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.2 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" Comparing a std::string to an empty string literal is more complex than using the std::string::empty() function. Improve the code efficiency by replacing the former with the latter. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/libcamera/yaml_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 8e15010b7dfa9c2a68dd57f924b5603784be0e09 diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index 5ca5fb8235b5e761..a5e424615c263f2d 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -194,7 +194,7 @@ YamlObject::Getter::get(const YamlObject &obj) const if (obj.type_ != Type::Value) return std::nullopt; - if (obj.value_ == "") + if (obj.value_.empty()) return std::nullopt; char *end;