diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-02-29 04:14:47 +0400 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-03-03 03:49:29 +0400 |
commit | 74fa4bfae37e9d7c9e35550c881b114d7a83c4fa (patch) | |
tree | 98184643a8c42b1402e4b33f835eac424fe88768 /src/vector.c | |
parent | 760db29c456ef2029a81d577d95a3fafb37ce5c6 (diff) |
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/vector.c')
-rw-r--r-- | src/vector.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vector.c b/src/vector.c index e109704ab..7513ea3f0 100644 --- a/src/vector.c +++ b/src/vector.c @@ -220,4 +220,14 @@ void git_vector_clear(git_vector *v) v->sorted = 1; } +void git_vector_swap(git_vector *a, git_vector *b) +{ + git_vector t; + + if (!a || !b || a == b) + return; + memcpy(&t, a, sizeof(t)); + memcpy(a, b, sizeof(t)); + memcpy(b, &t, sizeof(t)); +} |