git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] treewalk.c: Rename variable ret to cb_bits and remove some dead lines.
@ 2013-07-18 21:35 Stefan Beller
  2013-07-18 21:35 ` [PATCH 2/3] http-push.c, add_send_request: Do not initialize transfer_request Stefan Beller
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stefan Beller @ 2013-07-18 21:35 UTC (permalink / raw)
  To: gitster, git; +Cc: Stefan Beller

The variable name ret sounds like the variable to be returned, but
since e6c111b4 we return error. Hence the variable name is miss leading.
As this variable is used only to extract the bits from the callback of
a tree object, I named it cb_bits for callback bits.

Also the assignment to 0 was removed at the start of the function as well
after the if(interesting) block. Those were unneeded as that variable
is set to the callback return value any time we enter the if(interesting)
block, so we'd overwrite old values anyway.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
---
 tree-walk.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tree-walk.c b/tree-walk.c
index c366852..3c323d1 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -324,7 +324,6 @@ static inline int prune_traversal(struct name_entry *e,
 
 int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 {
-	int ret = 0;
 	int error = 0;
 	struct name_entry *entry = xmalloc(n*sizeof(*entry));
 	int i;
@@ -342,6 +341,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 		strbuf_setlen(&base, info->pathlen);
 	}
 	for (;;) {
+		int cb_bits;
 		unsigned long mask, dirmask;
 		const char *first = NULL;
 		int first_len = 0;
@@ -405,15 +405,14 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info)
 		if (interesting < 0)
 			break;
 		if (interesting) {
-			ret = info->fn(n, mask, dirmask, entry, info);
-			if (ret < 0) {
-				error = ret;
+			cb_bits = info->fn(n, mask, dirmask, entry, info);
+			if (cb_bits < 0) {
+				error = cb_bits;
 				if (!info->show_all_errors)
 					break;
 			}
-			mask &= ret;
+			mask &= cb_bits;
 		}
-		ret = 0;
 		for (i = 0; i < n; i++)
 			if (mask & (1ul << i))
 				update_extended_entry(tx + i, entry + i);
-- 
1.8.3.3.754.g9c3c367.dirty

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

end of thread, other threads:[~2013-07-19 22:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-18 21:35 [PATCH 1/3] treewalk.c: Rename variable ret to cb_bits and remove some dead lines Stefan Beller
2013-07-18 21:35 ` [PATCH 2/3] http-push.c, add_send_request: Do not initialize transfer_request Stefan Beller
2013-07-19 18:30   ` Junio C Hamano
2013-07-18 21:35 ` [PATCH 3/3] apply, find_name_traditional: Do not initialize len to the lines length Stefan Beller
2013-07-19 18:13 ` [PATCH 1/3] treewalk.c: Rename variable ret to cb_bits and remove some dead lines Junio C Hamano
2013-07-19 20:25   ` Stefan Beller
2013-07-19 20:26     ` [PATCH] traverse_trees(): clarify return value of the callback Stefan Beller
2013-07-19 22:28     ` [PATCH 1/3] treewalk.c: Rename variable ret to cb_bits and remove some dead lines Junio C Hamano

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 NNTP newsgroup(s).