From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7LdPLctzRmDSbAAAWB0awg (envelope-from ) for ; Mon, 08 Mar 2021 13:58:19 -0500 Received: by simark.ca (Postfix, from userid 112) id AE0D61EF78; Mon, 8 Mar 2021 13:58:19 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (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 ESMTPS id 5FC3F1E793 for ; Mon, 8 Mar 2021 13:58:19 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1FB16385041C; Mon, 8 Mar 2021 18:58:19 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id EB105385041C for ; Mon, 8 Mar 2021 18:58:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB105385041C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.192] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 84FB21E793; Mon, 8 Mar 2021 13:58:15 -0500 (EST) Subject: Re: [PATCH v2 1/5] gdb: add lookup_cmd_exact to simplify a common pattern To: Marco Barisione , gdb-patches@sourceware.org References: <20210108100706.96190-1-mbarisione@undo.io> <20210125112649.56362-1-mbarisione@undo.io> <20210125112649.56362-2-mbarisione@undo.io> From: Simon Marchi Message-ID: <7d3ff717-be8b-3bc3-374f-818f05ebfc9e@simark.ca> Date: Mon, 8 Mar 2021 13:58:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210125112649.56362-2-mbarisione@undo.io> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-01-25 6:26 a.m., Marco Barisione via Gdb-patches wrote: > In code dealing with commands, there's a pattern repeated a few times of > calling lookup_cmd with some speficic arguments and then using strcmp > on the returned command to check for an exact match. > As a later patch would add a few more similar lines of code, this patch > adds a new lookup_cmd_exact function which simplify this use case. > > gdb/ChangeLog: > > * cli/cli-decode.c (lookup_cmd_exact): Add. > * cli/cli-script.c (do_define_command): Use lookup_cmd_exact. > (define_prefix_command): Ditto. > * command.h: Add lookup_cmd_exact. This is ok, you can push it on its own right away, as it's a good cleanup on its own. Simon