summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-08-26 10:28:03 +0200
committerJunio C Hamano <gitster@pobox.com>2017-08-26 09:21:01 -0700
commita281639262238a315843a629a7686cff453d6fac (patch)
tree5652b33811c86f727ee6b20e44a24494448868e3 /notes.c
parentd3b0c6bebf3d8e85464b33d58e47a73894d882c7 (diff)
downloadgit-a281639262238a315843a629a7686cff453d6fac.tar.gz
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>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/notes.c b/notes.c
index a8b9371736..c33aead864 100644
--- a/notes.c
+++ b/notes.c
@@ -421,9 +421,6 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
void *buf;
struct tree_desc desc;
struct name_entry entry;
- int len, path_len;
- unsigned char type;
- struct leaf_node *l;
buf = fill_tree_descriptor(&desc, subtree->val_oid.hash);
if (!buf)
@@ -434,7 +431,10 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
assert(prefix_len * 2 >= n);
memcpy(object_oid.hash, subtree->key_oid.hash, prefix_len);
while (tree_entry(&desc, &entry)) {
- path_len = strlen(entry.path);
+ unsigned char type;
+ struct leaf_node *l;
+ int len, path_len = strlen(entry.path);
+
len = get_oid_hex_segment(entry.path, path_len,
object_oid.hash + prefix_len, GIT_SHA1_RAWSZ - prefix_len);
if (len < 0)