From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2AS9EDxTlWDlRAAAWB0awg (envelope-from ) for ; Fri, 07 May 2021 10:48:28 -0400 Received: by simark.ca (Postfix, from userid 112) id 42F9D1F11C; Fri, 7 May 2021 10:48:28 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [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 C9AB91E01F for ; Fri, 7 May 2021 10:48:27 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A57E3853815; Fri, 7 May 2021 14:48:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A57E3853815 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1620398907; bh=daQtE8eqR1hRDKwD+BYBxLpdp01UWq3zm77jABAoOqc=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gTZu53ZvjX3KVbNijGqoHlPSDGb3aEBqZtK1qpdEFN6I36RYqnuY04ktrNyMvThgP Z8tT0IXfiaPdXDdy8VJFnj1HLE9bfRXZjeSlvGrdkEcBVtwjPzJ9jFferapPjxTIES 48liEn3xxehWMKyK1I1CAkorInIPC404z7f11mF8= Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 31660385380F for ; Fri, 7 May 2021 14:48:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 31660385380F Received: by mail-ot1-x332.google.com with SMTP id 36-20020a9d0ba70000b02902e0a0a8fe36so1802807oth.8 for ; Fri, 07 May 2021 07:48:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=daQtE8eqR1hRDKwD+BYBxLpdp01UWq3zm77jABAoOqc=; b=s94qfWWie7LizcPxPQeFOwDIy6YTDVADB8Ls4OzxMM7N7LPPA+UZeI03HrTf36LHO0 bWBtJXUQ/hNhbew4ZvD+l1zPuEYhHwgfcCFLKJh+h+nrzVQLW6oADlOyxKTQ+hZVpJIs uIG7CkGMlCDuiwlKfQ9Tu73b2ci7qs+oYaMFf//0cDBgWgdnyLzxMKsY5qkV8HG7Of0L y/wp71KI6TweCA8DO/g1zUkBbiYnO3UeFjpBsChTq7lH2lB2OSElxEtuScv7BocAYdzX CnyW0wGsRkJICpZpyo4JY6n+AVk4i+JWtP/iuTzy6dBgEjYbgo3dx5cH5x39C2g5StFg xV2g== X-Gm-Message-State: AOAM5334kyAuy7glIojIMZWvpcXZY2WQwW6QSWotQzd7gL/YM3vPYGQc siZtCXB1gSihTSWr8CzIoCo6DsvQ93abFUx2OowcQs4N/8iL0xE7 X-Google-Smtp-Source: ABdhPJz/6Z/ywMmJnAqcPRZcEn7rVQEWqWRI1QQOu8eGECTGp0z4616Dspd0xNpjYcgZN96flZ9ACiMg9LDVboTCTPI= X-Received: by 2002:a9d:57cd:: with SMTP id q13mr5977613oti.23.1620398904562; Fri, 07 May 2021 07:48:24 -0700 (PDT) MIME-Version: 1.0 References: <20210108100706.96190-1-mbarisione@undo.io> <20210125112649.56362-1-mbarisione@undo.io> <20210125112649.56362-2-mbarisione@undo.io> <7d3ff717-be8b-3bc3-374f-818f05ebfc9e@simark.ca> In-Reply-To: <7d3ff717-be8b-3bc3-374f-818f05ebfc9e@simark.ca> Date: Fri, 7 May 2021 15:47:48 +0100 Message-ID: Subject: Re: [PATCH v2 1/5] gdb: add lookup_cmd_exact to simplify a common pattern To: Simon Marchi Content-Type: text/plain; charset="UTF-8" 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: , From: Marco Barisione via Gdb-patches Reply-To: Marco Barisione Cc: GDB patches mailing list Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On Mon, 8 Mar 2021 at 18:58, Simon Marchi wrote: > > 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. Thanks for your reviews! This is now pushed to master (a9b49cbcd5935a713da5715799ea3b24e0a52851). Sorry for taking a while, but I had to work on some other things. I will now follow up on this patch series to address your review comments. -- Marco Barisione