load_subtree(): reduce the scope of some local variables

Declare the variables inside the loop, to make it more obvious that their values are not carried across loop iterations. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Aug 26, 2017 at 10:28 UTC a281639262238a315843a629a7686cff453d6fac
1 file changed +4 -4
notes.c
+4 -4
@@ -421,9 +421,6 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
421 void *buf;
422 struct tree_desc desc;
423 struct name_entry entry;
424 - int len, path_len;
425 - unsigned char type;
426 - struct leaf_node *l;
424
425 buf = fill_tree_descriptor(&desc, subtree->val_oid.hash);
426 if (!buf)
@@ -434,7 +431,10 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
431 assert(prefix_len * 2 >= n);
432 memcpy(object_oid.hash, subtree->key_oid.hash, prefix_len);
433 while (tree_entry(&desc, &entry)) {
437 - path_len = strlen(entry.path);
434 + unsigned char type;
435 + struct leaf_node *l;
436 + int len, path_len = strlen(entry.path);
437 +
438 len = get_oid_hex_segment(entry.path, path_len,
439 object_oid.hash + prefix_len, GIT_SHA1_RAWSZ - prefix_len);
440 if (len < 0)