From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7B63F3858C54 for ; Thu, 11 May 2023 17:33:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B63F3858C54 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1A2A01E114; Thu, 11 May 2023 13:33:52 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdb: remove unnecessary call to std::string constructor Date: Thu, 11 May 2023 13:33:51 -0400 Message-Id: <20230511173351.41358-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3497.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I spotted this explicit call to std::string, which creates an unnecessary temporary extra std::string, while calling emplace_back. I'm not sure if it has any impact in an optimized build, maybe the compiler elides it. But still, it's unnecessary. Change-Id: I873337ea91db29ac06267aff8fc12dcf52824cac --- gdb/cli/cli-decode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 948592a6f621..b84ce8375fb7 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -155,7 +155,7 @@ cmd_list_element::command_components () const if (this->prefix != nullptr) result = this->prefix->command_components (); - result.emplace_back (std::string (this->name)); + result.emplace_back (this->name); return result; } base-commit: b7ea736a38013510cd0496b42a8eb2dd2d2f6830 -- 2.40.1