summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-06-09 04:38:22 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-06-10 15:14:13 +0200
commit4d3f1f97404b01cd00ad5b2f47f64672d787e901 (patch)
tree3e1463a9d8fc93ad43dc10bc7034db466c4dfbc9 /include
parent7064cdafbd25f66de016467b381d9f4474fba40a (diff)
downloadlibgit2-4d3f1f97404b01cd00ad5b2f47f64672d787e901.tar.gz
treebuilder: use a map instead of vector to store the entries
Finding a filename in a vector means we need to resort it every time we want to read from it, which includes every time we want to write to it as well, as we want to find duplicate keys. A hash-map fits what we want to do much more accurately, as we do not care about sorting, but just the particular filename. We still keep removed entries around, as the interface let you assume they were going to be around until the treebuilder is cleared or freed, but in this case that involves an append to a vector in the filter case, which can now fail. The only time we care about sorting is when we write out the tree, so let's make that the only time we do any sorting.
Diffstat (limited to 'include')
-rw-r--r--include/git2/tree.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/git2/tree.h b/include/git2/tree.h
index 56922d40b..8f1d8a089 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -354,7 +354,7 @@ typedef int (*git_treebuilder_filter_cb)(
* @param filter Callback to filter entries
* @param payload Extra data to pass to filter callback
*/
-GIT_EXTERN(void) git_treebuilder_filter(
+GIT_EXTERN(int) git_treebuilder_filter(
git_treebuilder *bld,
git_treebuilder_filter_cb filter,
void *payload);