From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 7BF501F66E for ; Wed, 19 Aug 2020 19:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726852AbgHSTjV (ORCPT ); Wed, 19 Aug 2020 15:39:21 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:41997 "EHLO mail-ej1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgHSTjV (ORCPT ); Wed, 19 Aug 2020 15:39:21 -0400 Received: by mail-ej1-f67.google.com with SMTP id g19so27662635ejc.9 for ; Wed, 19 Aug 2020 12:39:19 -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=4IfgI87ZJ4hjktmBvnpNsAf4YCftcoL6+QHhT/pJQlo=; b=th7LRYKNzPLvqdqrMczAdMX8Kby1aJYvranDLC+KEOETj8wQgg8/+ZHCJZu6Z2tmb1 jmGo2OklSY5gLV0w8jmrqF1ZE5mWjdOCb7V3sr5JUpwQNzbjLWbN5wvZt1nDecyHIqtt oQjq5lugJDzwPywK/rr7MXBbyPmh37XSywhDyWfidMc9DKWmEJmNR9pqIVBqnPESemUF 6JpIjhm2706vClKhT8LOypIa6raTO2abQU95I2v9i1UQJ3nh1AN6XIYWO98OVt51FV4I Fe26T6THNPolPk9QR5YDjawW2TlrCKCmrnjZcGLrY9qVknclR7gHBED8a7W/m8A3YeOC E0IA== X-Gm-Message-State: AOAM533nTkmEUGUwr7+WTgxuANgidzMRn1DMEWdgqQwqV1SYL7NOq6RU kP0wJqU7an/Rb4OlASh4R8G9cyJmGkVBrzN0KOE= X-Google-Smtp-Source: ABdhPJxL7sT5gy+x/3JzG+2ryLB+SfZMMETbFhc8GrLaa3676ZxfK0O2VGiUw/rb3OppADqwvDKnQkwSTeZcOHQv4To= X-Received: by 2002:a17:906:a1cf:: with SMTP id bx15mr401067ejb.231.1597865959099; Wed, 19 Aug 2020 12:39:19 -0700 (PDT) MIME-Version: 1.0 References: <7daf9335a501b99c29e299f72823fcb7e549e748.1597841551.git.gitgitgadget@gmail.com> In-Reply-To: From: Eric Sunshine Date: Wed, 19 Aug 2020 15:39:07 -0400 Message-ID: Subject: Re: [PATCH 2/2] ref-filter: 'contents:trailers' show error if `:` is missing To: Junio C Hamano Cc: Hariom Verma via GitGitGadget , Git List , Hariom Verma Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Aug 19, 2020 at 3:07 PM Junio C Hamano wrote: > Junio C Hamano writes: > > "Hariom Verma via GitGitGadget" writes: > >> +static int check_format_field(const char *arg, const char *field, const char **option) > >> +{ > >> + else if (*opt == ':') { > >> + *option = ++opt; > >> + return 1; > >> + } > > And the helper does not have such a breakage. It looks good. One minor comment (not worth a re-roll): I personally found: *option = ++opt; more confusing than: *option = opt + 1; The `++opt` places a higher cognitive load on the reader. As a reviewer, I had to go back and carefully reread the function to see if the side-effect of `++opt` had some impact which I didn't notice on the first readthrough. The simpler `opt + 1` does not have a side-effect, thus is easier to reason about (and doesn't require me to re-study the function when I encounter it).