diff options
author | Russell Belfer <arrbee@arrbee.com> | 2011-12-30 15:00:14 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2011-12-30 15:00:14 -0800 |
commit | bd370b14fefdba3844a9bf0bbf87171ca48f49be (patch) | |
tree | b16a3e4ee778d33fb7782b26c7cffb3068b63087 /src/vector.h | |
parent | c6d2a2c0946ff32c16578b68b39824f4fea8f782 (diff) | |
download | libgit2-bd370b14fefdba3844a9bf0bbf87171ca48f49be.tar.gz |
Improved gitattributes macro implementation
This updates to implementation of gitattribute macros to be much more
similar to core git (albeit not 100%) and to handle expansion of
macros within macros, etc. It also cleans up the refcounting usage
with macros to be much cleaner.
Also, this adds a new vector function `git_vector_insert_sorted()`
which allows you to maintain a sorted list as you go. In order to
write that function, this changes the function `git__bsearch()` to
take a somewhat different set of parameters, although the core
functionality is still the same.
Diffstat (limited to 'src/vector.h')
-rw-r--r-- | src/vector.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vector.h b/src/vector.h index 4c053e6ae..9ee3c9ed5 100644 --- a/src/vector.h +++ b/src/vector.h @@ -45,6 +45,9 @@ GIT_INLINE(void *) git_vector_get(git_vector *v, unsigned int position) for ((iter) = (v)->length; (iter) > 0 && ((elem) = (v)->contents[(iter)-1], 1); (iter)-- ) int git_vector_insert(git_vector *v, void *element); +int git_vector_insert_sorted(git_vector *v, void *element, + int (*on_dup)(void **old, void *new)); int git_vector_remove(git_vector *v, unsigned int idx); void git_vector_uniq(git_vector *v); + #endif |