The struct tree_content *t variable was used as a shorthand for the given root->tree, but it was only used in the first two lines of the for loop, so the shorthand itself does not add much value. Furthermore, since the for loop body might end up reallocating root->tree we had to reinitialize t at the end of the for loop body, which is ugly and brittle. Simply use root->tree directly instead, and remote the t shorthand. Signed-off-by: Johan Herland <johan@xxxxxxxxxxx> --- fast-import.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fast-import.c b/fast-import.c index d0bd285..04dfd50 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2153,15 +2153,14 @@ static uintmax_t do_change_note_fanout( char *fullpath, unsigned int fullpath_len, unsigned char fanout) { - struct tree_content *t = root->tree; struct tree_entry *e, leaf; unsigned int i, tmp_hex_sha1_len, tmp_fullpath_len; uintmax_t num_notes = 0; unsigned char sha1[20]; char realpath[60]; - for (i = 0; t && i < t->entry_count; i++) { - e = t->entries[i]; + for (i = 0; root->tree && i < root->tree->entry_count; i++) { + e = root->tree->entries[i]; tmp_hex_sha1_len = hex_sha1_len + e->name->str_len; tmp_fullpath_len = fullpath_len; @@ -2217,9 +2216,6 @@ static uintmax_t do_change_note_fanout( hex_sha1, tmp_hex_sha1_len, fullpath, tmp_fullpath_len, fanout); } - - /* The above may have reallocated the current tree_content */ - t = root->tree; } return num_notes; } -- 2.1.1.392.g062cc5d -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html