Merge branch 'mh/notes-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Tue, 19 Sep 2017 01:47:52 +0000 (10:47 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Sep 2017 01:47:52 +0000 (10:47 +0900)
Code clean-up.

* mh/notes-cleanup:
load_subtree(): check that `prefix_len` is in the expected range
load_subtree(): declare some variables to be `size_t`
hex_to_bytes(): simpler replacement for `get_oid_hex_segment()`
get_oid_hex_segment(): don't pad the rest of `oid`
load_subtree(): combine some common code
get_oid_hex_segment(): return 0 on success
load_subtree(): only consider blobs to be potential notes
load_subtree(): check earlier whether an internal node is a tree entry
load_subtree(): separate logic for internal vs. terminal entries
load_subtree(): fix incorrect comment
load_subtree(): reduce the scope of some local variables
load_subtree(): remove unnecessary conditional
notes: make GET_NIBBLE macro more robust

1  2 
notes.c
diff --cc notes.c
index f090c88363883e65cea66fd63b2c8dfb3f642b7d,27d232f294d514113613031ac4f18d8d3d19311f..5c62862574399acb486530d3fab5a7f659eb7c2f
+++ b/notes.c
@@@ -421,11 -410,8 +410,8 @@@ static void load_subtree(struct notes_t
        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);
 +      buf = fill_tree_descriptor(&desc, &subtree->val_oid);
        if (!buf)
                die("Could not read %s for notes-index",
                     oid_to_hex(&subtree->val_oid));