Thread (24 messages) 24 messages, 3 authors, 2020-01-31
STALE2353d

[PATCH v2 03/11] bisect: use the standard 'if (!var)' way to check for 0

From: Miriam Rubio <hidden>
Date: 2020-01-28 14:41:21
Subsystem: the rest · Maintainer: Linus Torvalds

Instead of using 'var == 0' in an if condition, let's use '!var' and
make 'bisect.c' more consistent with the rest of the code.

Mentored-by: Christian Couder [off-list ref]
Signed-off-by: Miriam Rubio <redacted>
---
 bisect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bisect.c b/bisect.c
index e81c91d02c..83cb5b3a98 100644
--- a/bisect.c
+++ b/bisect.c
@@ -572,7 +572,7 @@ static int sqrti(int val)
 {
 	float d, x = val;
 
-	if (val == 0)
+	if (!val)
 		return 0;
 
 	do {
@@ -869,7 +869,7 @@ static void check_good_are_ancestors_of_bad(struct repository *r,
 		goto done;
 
 	/* Bisecting with no good rev is ok. */
-	if (good_revs.nr == 0)
+	if (!good_revs.nr)
 		goto done;
 
 	/* Check if all good revs are ancestor of the bad rev. */
-- 
2.21.1 (Apple Git-122.3)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help