diff options
author | Vicent Martà <vicent@github.com> | 2013-08-28 06:05:50 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-08-28 06:05:50 -0700 |
commit | 1ef05e3f0ea8fa8db2167307101c8c43d1c1784b (patch) | |
tree | 0eb68083767ea2fe111099418d2dc280b2f94d49 /src/vector.c | |
parent | d07cc8a2f7a197bd1b09092467212697995ff9a3 (diff) | |
parent | aec87f712fd1e84038d5d14b83a97d78e2e1b1ad (diff) | |
download | libgit2-1ef05e3f0ea8fa8db2167307101c8c43d1c1784b.tar.gz |
Merge pull request #1803 from libgit2/ntk/topic/even_more_lenient_remote_parsing
Even more lenient remote parsing
Diffstat (limited to 'src/vector.c')
-rw-r--r-- | src/vector.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vector.c b/src/vector.c index 5ba2fab18..362e7b0c0 100644 --- a/src/vector.c +++ b/src/vector.c @@ -220,7 +220,7 @@ void git_vector_pop(git_vector *v) v->length--; } -void git_vector_uniq(git_vector *v) +void git_vector_uniq(git_vector *v, void (*git_free_cb)(void *)) { git_vector_cmp cmp; size_t i, j; @@ -232,9 +232,12 @@ void git_vector_uniq(git_vector *v) cmp = v->_cmp ? v->_cmp : strict_comparison; for (i = 0, j = 1 ; j < v->length; ++j) - if (!cmp(v->contents[i], v->contents[j])) + if (!cmp(v->contents[i], v->contents[j])) { + if (git_free_cb) + git_free_cb(v->contents[i]); + v->contents[i] = v->contents[j]; - else + } else v->contents[++i] = v->contents[j]; v->length -= j - i - 1; |