git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/7] config: avoid yoda conditions

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Dec 8, 2013, 05:56 UTC
Message-ID
<1386482220-18558-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1386482220-18558-1-git-send-email-felipe.contreras@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index e1d66a1..7a44414 100644
--- a/config.c
+++ b/config.c
@@ -610,7 +610,7 @@ static int git_config_maybe_bool_text(const char *name, const char *value)
 int git_config_maybe_bool(const char *name, const char *value)
 {
 	int v = git_config_maybe_bool_text(name, value);
-	if (0 <= v)
+	if (v >= 0)
 		return v;
 	if (git_parse_int(value, &v))
 		return !!v;
@@ -620,7 +620,7 @@ int git_config_maybe_bool(const char *name, const char *value)
 int git_config_bool_or_int(const char *name, const char *value, int *is_bool)
 {
 	int v = git_config_maybe_bool_text(name, value);
-	if (0 <= v) {
+	if (v >= 0) {
 		*is_bool = 1;
 		return v;
 	}
-- 
1.8.5.1+fc1.2.gebd1fb1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 11 in “Trivial patches”
  1. 0/7 Trivial patchesFelipe Contreras, Dec 8, 2013
  2. 1/7 config: avoid yoda conditionsFelipe Contreras, Dec 8, 2013
  3. 2/7 add: avoid yoda conditionsFelipe Contreras, Dec 8, 2013
  4. 3/7 abspath: trivial style fixFelipe Contreras, Dec 8, 2013
  5. Junio C HamanoDec 9, 2013
  6. 4/7 t: trivial whitespace cleanupsFelipe Contreras, Dec 8, 2013
  7. 5/7 fetch: add missing documentationFelipe Contreras, Dec 8, 2013
  8. Junio C HamanoDec 9, 2013
  9. 6/7 sha1_name: cleanup interpret_branch_name()Felipe Contreras, Dec 8, 2013
  10. Philip OakleyDec 8, 2013
  11. 7/7 sha1_name: simplify track findingFelipe Contreras, Dec 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.