Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2012-10-30 05:04:21 +0400
committerEdward Thomson <ethomson@edwardthomson.com>2012-10-30 05:04:21 +0400
commitf45ec1a076e2347ba5d63eeb2d158f87b612e5cb (patch)
tree2e2bebc12e64e6f48eabde6010bf775b3fc6cd6e /src/vector.c
parent81eecc342b3580e9b05e501c8ee75c7e2e0dca1a (diff)
index refactoring
Diffstat (limited to 'src/vector.c')
-rw-r--r--src/vector.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vector.c b/src/vector.c
index c6a644cc3..d9c4c9900 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -223,6 +223,20 @@ void git_vector_uniq(git_vector *v)
v->length -= j - i - 1;
}
+void git_vector_remove_matching(git_vector *v, int (*match)(git_vector *v, size_t idx))
+{
+ unsigned int i, j;
+
+ for (i = 0, j = 0; j < v->length; ++j) {
+ v->contents[i] = v->contents[j];
+
+ if (!match(v, i))
+ i++;
+ }
+
+ v->length = i;
+}
+
void git_vector_clear(git_vector *v)
{
assert(v);