git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: dyrone teng <dyroneteng@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fix a small flaw in the comment of strmap.h
Date: Thu, 6 May 2021 16:49:36 +0800	[thread overview]
Message-ID: <CADMgQSRg559o_MLSsPvAU3c7_2uWWm0LuBkPZaQ-PD=oqqAEJQ@mail.gmail.com> (raw)
In-Reply-To: <xmqq35v0z1uw.fsf@gitster.g>

>The original is correct; this function returns a non-zero value if
>and only if (iff is a common abbreviation for this expression) "str"
>is in the map, implying that when "str" is not in the map, the
>caller can rest assured that the function will not return a non-zero
>value (in other words, the caller is guaranteed to receive zero).

>If you change that to "if", the comment no longer says what happens
>when "str" is *not* present in the map, which is making it worse.

Thanks, got it.

Junio C Hamano <gitster@pobox.com> 于2021年5月6日周四 下午4:46写道:
>
> Teng Long <dyroneteng@gmail.com> writes:
>
> > Subject: Re: [PATCH] Fix a small flaw in the comment of strmap.h
>
> cf. Documentation/SubmittingPatches::summary-section
>
> > Signed-off-by: Teng Long <dyroneteng@gmail.com>
> > ---
> >  strmap.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/strmap.h b/strmap.h
> > index 1e152d832d..0d1d00d14e 100644
> > --- a/strmap.h
> > +++ b/strmap.h
> > @@ -78,7 +78,7 @@ struct strmap_entry *strmap_get_entry(struct strmap *map, const char *str);
> >  void *strmap_get(struct strmap *map, const char *str);
> >
> >  /*
> > - * Return non-zero iff "str" is present in the map. This differs from
> > + * Return non-zero if "str" is present in the map. This differs from
>
> The original is correct; this function returns a non-zero value if
> and only if (iff is a common abbreviation for this expression) "str"
> is in the map, implying that when "str" is not in the map, the
> caller can rest assured that the function will not return a non-zero
> value (in other words, the caller is guaranteed to receive zero).
>
> If you change that to "if", the comment no longer says what happens
> when "str" is *not* present in the map, which is making it worse.

      reply	other threads:[~2021-05-06  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  8:19 [PATCH] Fix a small flaw in the comment of strmap.h Teng Long
2021-05-06  8:46 ` Junio C Hamano
2021-05-06  8:49   ` dyrone teng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADMgQSRg559o_MLSsPvAU3c7_2uWWm0LuBkPZaQ-PD=oqqAEJQ@mail.gmail.com' \
    --to=dyroneteng@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).