summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-20 14:01:46 -0800
committerBen Straub <bs@github.com>2012-11-27 13:18:28 -0800
commite120123e369a036cd40b8f085cebd55463466796 (patch)
tree287aa87eeb807edd042dcb08ab5add3149054c7b /src/tree.c
parent824cb2d5e587f13b596933b991c7d8568422946a (diff)
downloadlibgit2-e120123e369a036cd40b8f085cebd55463466796.tar.gz
API review / update for tree.h
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/tree.c b/src/tree.c
index 6f9838880..252980182 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -166,6 +166,7 @@ git_tree_entry *git_tree_entry_dup(const git_tree_entry *entry)
return NULL;
memcpy(copy, entry, total_size);
+
return copy;
}
@@ -288,10 +289,10 @@ int git_tree__prefix_position(git_tree *tree, const char *path)
return at_pos;
}
-unsigned int git_tree_entrycount(const git_tree *tree)
+size_t git_tree_entrycount(const git_tree *tree)
{
assert(tree);
- return (unsigned int)tree->entries.length;
+ return tree->entries.length;
}
static int tree_error(const char *str)
@@ -694,7 +695,10 @@ on_error:
return -1;
}
-void git_treebuilder_filter(git_treebuilder *bld, int (*filter)(const git_tree_entry *, void *), void *payload)
+void git_treebuilder_filter(
+ git_treebuilder *bld,
+ git_treebuilder_filter_cb filter,
+ void *payload)
{
unsigned int i;
@@ -855,23 +859,27 @@ static int tree_walk(
return error;
}
-int git_tree_walk(git_tree *tree, git_treewalk_cb callback, int mode, void *payload)
+int git_tree_walk(
+ git_tree *tree,
+ git_treewalk_mode mode,
+ git_treewalk_cb callback,
+ void *payload)
{
int error = 0;
git_buf root_path = GIT_BUF_INIT;
switch (mode) {
- case GIT_TREEWALK_POST:
- error = tree_walk(tree, callback, &root_path, payload, false);
- break;
+ case GIT_TREEWALK_POST:
+ error = tree_walk(tree, callback, &root_path, payload, false);
+ break;
- case GIT_TREEWALK_PRE:
- error = tree_walk(tree, callback, &root_path, payload, true);
- break;
+ case GIT_TREEWALK_PRE:
+ error = tree_walk(tree, callback, &root_path, payload, true);
+ break;
- default:
- giterr_set(GITERR_INVALID, "Invalid walking mode for tree walk");
- return -1;
+ default:
+ giterr_set(GITERR_INVALID, "Invalid walking mode for tree walk");
+ return -1;
}
git_buf_free(&root_path);