Commit 247e3b4305f317bede88a225788239df57a8aa6d

Edward Thomson 2016-03-21T16:51:45

iterator: mandate `advance_over` Since the three iterators implement `advance_over` differently, mandate it and implement each.

diff --git a/src/iterator.c b/src/iterator.c
index 720a3d1..cf3e29b 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -1070,6 +1070,15 @@ static int tree_iterator_advance_into(
 	return tree_iterator_advance(out, i);
 }
 
+static int tree_iterator_advance_over(
+	const git_index_entry **out,
+	git_iterator_status_t *status,
+	git_iterator *i)
+{
+	*status = GIT_ITERATOR_STATUS_NORMAL;
+	return git_iterator_advance(out, i);
+}
+
 static void tree_iterator_clear(tree_iterator *iter)
 {
 	while (iter->frames.size)
@@ -1143,7 +1152,7 @@ int git_iterator_for_tree(
 		tree_iterator_current,
 		tree_iterator_advance,
 		tree_iterator_advance_into,
-		NULL, /* advance_over */
+		tree_iterator_advance_over,
 		tree_iterator_reset,
 		tree_iterator_reset_range,
 		tree_iterator_at_end,
diff --git a/src/iterator.h b/src/iterator.h
index 460f947..51ba3f7 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -217,11 +217,7 @@ GIT_INLINE(int) git_iterator_advance_over(
 	git_iterator_status_t *status,
 	git_iterator *iter)
 {
-	if (iter->cb->advance_over)
-		return iter->cb->advance_over(entry, status, iter);
-
-	*status = GIT_ITERATOR_STATUS_NORMAL;
-	return git_iterator_advance(entry, iter);
+	return iter->cb->advance_over(entry, status, iter);
 }
 
 /**