diff options
| author | Russell Belfer <rb@github.com> | 2014-02-03 21:02:08 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-02-03 21:02:08 -0800 |
| commit | 4075e060b45a73834a24684ed835d52f7176d58b (patch) | |
| tree | 89c615474fec2a85c3e53edf699531a76c1e228f /src/vector.h | |
| parent | 40e10630cfbdddd878a6347c1751092bab7f7a28 (diff) | |
| download | libgit2-4075e060b45a73834a24684ed835d52f7176d58b.tar.gz | |
Replace pqueue with code from hashsig heap
I accidentally wrote a separate priority queue implementation when
I was working on file rename detection as part of the file hash
signature calculation code. To simplify licensing terms, I just
adapted that to a general purpose priority queue and replace the
old priority queue implementation that was borrowed from elsewhere.
This also removes parts of the COPYING document that no longer
apply to libgit2.
Diffstat (limited to 'src/vector.h')
| -rw-r--r-- | src/vector.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vector.h b/src/vector.h index d318463c6..e8a967813 100644 --- a/src/vector.h +++ b/src/vector.h @@ -95,4 +95,14 @@ GIT_INLINE(void) git_vector_set_cmp(git_vector *v, git_vector_cmp cmp) } } +/** Swap two elements */ +#define git_vector_swap_elements(V, P1, P2) do { \ + void *__t = (V)->contents[P1]; \ + (V)->contents[P1] = (V)->contents[P2]; \ + (V)->contents[P2] = __t; } while (0) + +/** Compare two elements */ +#define git_vector_cmp_elements(V, P1, P2) \ + (V)->_cmp(git_vector_get(V,P1), git_vector_get(V,P2)) + #endif |
