summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-02-04 10:01:37 -0800
committerRussell Belfer <rb@github.com>2014-02-04 10:01:37 -0800
commit882c7742711199f757305687c257ac97262a3a30 (patch)
tree72de2a06120aa30875cde571454e77f4441d449c /src/tree.c
parentaf4bc6615d9fe0ebcc4abb939273913bcf9aee60 (diff)
downloadlibgit2-882c7742711199f757305687c257ac97262a3a30.tar.gz
Convert pqueue to just be a git_vector
This updates the git_pqueue to simply be a set of specialized init/insert/pop functions on a git_vector. To preserve the pqueue feature of having a fixed size heap, I converted the "sorted" field in git_vectors to a more general "flags" field so that pqueue could mix in it's own flag. This had a bunch of ramifications because a number of places were directly looking at the vector "sorted" field - I added a couple new git_vector helpers (is_sorted, set_sorted) so the specific representation of this information could be abstracted.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tree.c b/src/tree.c
index 877a3fcee..94f779eca 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -283,7 +283,8 @@ static const git_tree_entry *entry_fromname(
{
size_t idx;
- assert(tree->entries.sorted); /* be safe when we cast away constness */
+ /* be safe when we cast away constness - i.e. don't trigger a sort */
+ assert(git_vector_is_sorted(&tree->entries));
if (tree_key_search(&idx, (git_vector *)&tree->entries, name, name_len) < 0)
return NULL;
@@ -333,7 +334,8 @@ int git_tree__prefix_position(const git_tree *tree, const char *path)
ksearch.filename = path;
ksearch.filename_len = strlen(path);
- assert(tree->entries.sorted); /* be safe when we cast away constness */
+ /* be safe when we cast away constness - i.e. don't trigger a sort */
+ assert(git_vector_is_sorted(&tree->entries));
/* Find tree entry with appropriate prefix */
git_vector_bsearch2(