mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-20 19:55:25 +00:00
Add git_vector_foreach
You can use it just as you'd use a for-loop Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
parent
b5b474dd0d
commit
bcf21c556c
@ -30,6 +30,9 @@ GIT_INLINE(void *) git_vector_get(git_vector *v, unsigned int position)
|
|||||||
return (position < v->length) ? v->contents[position] : NULL;
|
return (position < v->length) ? v->contents[position] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define git_vector_foreach(v, iter, elem) \
|
||||||
|
for ((iter) = 0; (iter) < (v)->length && ((elem) = (v)->contents[(iter)], 1); (iter)++ )
|
||||||
|
|
||||||
int git_vector_insert(git_vector *v, void *element);
|
int git_vector_insert(git_vector *v, void *element);
|
||||||
int git_vector_remove(git_vector *v, unsigned int idx);
|
int git_vector_remove(git_vector *v, unsigned int idx);
|
||||||
void git_vector_uniq(git_vector *v);
|
void git_vector_uniq(git_vector *v);
|
||||||
|
Loading…
Reference in New Issue
Block a user