]> git.proxmox.com Git - libgit2.git/commitdiff
iterator: mandate `advance_over`
authorEdward Thomson <ethomson@github.com>
Mon, 21 Mar 2016 20:51:45 +0000 (16:51 -0400)
committerEdward Thomson <ethomson@github.com>
Thu, 24 Mar 2016 19:59:48 +0000 (15:59 -0400)
Since the three iterators implement `advance_over` differently,
mandate it and implement each.

src/iterator.c
src/iterator.h

index 720a3d17a86479bf80a28b0edf033078d31b353f..cf3e29b718a3ac2b882aa49aaf7822f2b4e79d16 100644 (file)
@@ -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,
index 460f9475ae46ebf503893755bbd8edd3ed382f74..51ba3f777ffd2a90776ddabdd678093755f05774 100644 (file)
@@ -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);
 }
 
 /**