From patchwork Thu May 11 17:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 69175 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6DD6C3857028 for ; Thu, 11 May 2023 17:34:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DD6C3857028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683826455; bh=JCOCtBdi99iPH9vzzSzvo3ar+MsawZAIQPD94N2e17E=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=RR+yB71KsT3wScdEl8leIlKqfAQh7FVmPDbdDnvF5I6Ah17q+jQjJZYtbdMGEY2JX uB0vaIMJzHqyqk6CtDb5J0S5c82wkWZTxsJ5ZtFcy7G+Q767+/uUJfXqWdVaGZa+j6 a9gf4IbLqc/LcngHZJN9jnGKUmmAxaFSdkeDIQso= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 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) 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 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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(-) base-commit: b7ea736a38013510cd0496b42a8eb2dd2d2f6830 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; }