Re: [PATCH] Fix a small flaw in the comment of strmap.h

2 messages, 2 authors, 2021-05-06 · open the first message on its own page

Re: [PATCH] Fix a small flaw in the comment of strmap.h

From: Junio C Hamano <hidden>
Date: 2021-05-06 08:46:18

Teng Long [off-list ref] writes:
Subject: Re: [PATCH] Fix a small flaw in the comment of strmap.h
cf. Documentation/SubmittingPatches::summary-section
quoted hunk
Signed-off-by: Teng Long <redacted>
---
 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.

Re: [PATCH] Fix a small flaw in the comment of strmap.h

From: dyrone teng <hidden>
Date: 2021-05-06 08:49:54

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 [off-list ref] 于2021年5月6日周四 下午4:46写道:
Teng Long [off-list ref] writes:
quoted
Subject: Re: [PATCH] Fix a small flaw in the comment of strmap.h
cf. Documentation/SubmittingPatches::summary-section
quoted
Signed-off-by: Teng Long <redacted>
---
 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help