summaryrefslogtreecommitdiff
path: root/src/iterator.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-02-28 16:14:47 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-03-02 15:49:29 -0800
commit74fa4bfae37e9d7c9e35550c881b114d7a83c4fa (patch)
tree98184643a8c42b1402e4b33f835eac424fe88768 /src/iterator.h
parent760db29c456ef2029a81d577d95a3fafb37ce5c6 (diff)
downloadlibgit2-74fa4bfae37e9d7c9e35550c881b114d7a83c4fa.tar.gz
Update diff to use iterators
This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
Diffstat (limited to 'src/iterator.h')
-rw-r--r--src/iterator.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/iterator.h b/src/iterator.h
index ac30b4ded..aa78c9f29 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -23,6 +23,7 @@ struct git_iterator {
int (*current)(git_iterator *, const git_index_entry **);
int (*at_end)(git_iterator *);
int (*advance)(git_iterator *, const git_index_entry **);
+ int (*reset)(git_iterator *);
void (*free)(git_iterator *);
};
@@ -60,6 +61,11 @@ GIT_INLINE(int) git_iterator_advance(
return iter->advance(iter, entry);
}
+GIT_INLINE(int) git_iterator_reset(git_iterator *iter)
+{
+ return iter->reset(iter);
+}
+
GIT_INLINE(void) git_iterator_free(git_iterator *iter)
{
iter->free(iter);