git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Fix a small flaw in the comment of strmap.h
@ 2021-05-06  8:19 Teng Long
  2021-05-06  8:46 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Teng Long @ 2021-05-06  8:19 UTC (permalink / raw)
  To: git; +Cc: Teng Long

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
  * strmap_get() in that it can distinguish entries with a NULL data pointer.
  */
 int strmap_contains(struct strmap *map, const char *str);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a small flaw in the comment of strmap.h
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2021-05-06  8:46 UTC (permalink / raw)
  To: Teng Long; +Cc: git

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix a small flaw in the comment of strmap.h
  2021-05-06  8:46 ` Junio C Hamano
@ 2021-05-06  8:49   ` dyrone teng
  0 siblings, 0 replies; 3+ messages in thread
From: dyrone teng @ 2021-05-06  8:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

>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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-06  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git