author | Junio C Hamano <gitster@pobox.com> | |
Thu, 27 Oct 2011 18:18:40 +0000 (11:18 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 27 Oct 2011 18:24:01 +0000 (11:24 -0700) | ||
commit | 5fb8c05f2e5da483898019f7abc0e52e07bc0c50 | |
tree | 72c2b4a42a428bdd78fcbdb00b9d21b1eda8e1a7 | tree | snapshot |
parent | 0de1633783685e9fb1943551217cdda7edbd245b | commit | diff |
get_tree_entry(): do not call find_tree_entry() on an empty tree
We know we will find nothing.
This incidentally squelches false warning from gcc about potentially
uninitialized usage of t.entry fields. For an empty tree, it is true that
init_tree_desc() does not call decode_tree_entry() and the tree_desc is
left uninitialized, but find_tree_entry() only calls tree_entry_extract()
that uses the tree_desc while it has more things to read from the tree, so
the uninitialized t.entry fields are never used in such a case anyway.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We know we will find nothing.
This incidentally squelches false warning from gcc about potentially
uninitialized usage of t.entry fields. For an empty tree, it is true that
init_tree_desc() does not call decode_tree_entry() and the tree_desc is
left uninitialized, but find_tree_entry() only calls tree_entry_extract()
that uses the tree_desc while it has more things to read from the tree, so
the uninitialized t.entry fields are never used in such a case anyway.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree-walk.c | diff | blob | history |