From 4075e060b45a73834a24684ed835d52f7176d58b Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Mon, 3 Feb 2014 21:02:08 -0800 Subject: 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. --- src/vector.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/vector.h') 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 -- cgit v1.2.1