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.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 6BEE71F66E for ; Wed, 19 Aug 2020 22:08:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbgHSWIs (ORCPT ); Wed, 19 Aug 2020 18:08:48 -0400 Received: from pb-smtp20.pobox.com ([173.228.157.52]:52538 "EHLO pb-smtp20.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726209AbgHSWIp (ORCPT ); Wed, 19 Aug 2020 18:08:45 -0400 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id A8210F19B0; Wed, 19 Aug 2020 18:08:43 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Un8Y2LK1uViInuRvPiCRh1p2fv4=; b=BKbNeE CQfZelTEF2x7i/vz8vaBOdlsWKfzRgionRMksvnsIf8wShPZpTq7K5f9cvE7v2Ff xUI4WSYuvWzEOfXyFxxNO5IJhIUy0wuCSrkdzbss3CZdEAOSbiFZePyb8xWO5s2j pRwpG/vNK8g+kG6IuAW36xhJOrttAKfOatSvc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=YJoWNdr3FBrwnzp9WFkBQQa9ZR2ha8nH Srpc8fJbOGuiM5TqpsjfasTgfF+ox77/QOCxftkPO1LR6PLN9NiqTLhB6/NprFTj 5H+Dmhd0CmEMsfZrlbbA9f+f/zyFgH+DYhnUCCLX10n1FRda4t3gYrOcdXC2wiea DErA4V/ZkCI= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id A124CF19AF; Wed, 19 Aug 2020 18:08:43 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [34.75.7.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id ECC41F19AD; Wed, 19 Aug 2020 18:08:40 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Eric Sunshine Cc: Hariom Verma via GitGitGadget , Git List , Hariom Verma Subject: Re: [PATCH 2/2] ref-filter: 'contents:trailers' show error if `:` is missing References: <7daf9335a501b99c29e299f72823fcb7e549e748.1597841551.git.gitgitgadget@gmail.com> Date: Wed, 19 Aug 2020 15:08:39 -0700 In-Reply-To: (Eric Sunshine's message of "Wed, 19 Aug 2020 15:39:07 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 8A1CEC26-E268-11EA-A076-F0EA2EB3C613-77302942!pb-smtp20.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Eric Sunshine writes: > 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). That makes the two of us ... thanks.