Commit 2375be48309e25178fad67ed4f811b948f748478

Edward Thomson 2019-05-21T12:57:28

tree: return `size_t` for treebuilder entrycount We keep the treebuilder entrycount as a `size_t` - return that instead of downcasting to an `unsigned int`. Callers who were storing this value in an `unsigned int` will continue to downcast themselves, so there should be no behavior change for callers.

diff --git a/include/git2/tree.h b/include/git2/tree.h
index aca5d75..4455d2e 100644
--- a/include/git2/tree.h
+++ b/include/git2/tree.h
@@ -267,7 +267,7 @@ GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
  * @param bld a previously loaded treebuilder.
  * @return the number of entries in the treebuilder
  */
-GIT_EXTERN(unsigned int) git_treebuilder_entrycount(git_treebuilder *bld);
+GIT_EXTERN(size_t) git_treebuilder_entrycount(git_treebuilder *bld);
 
 /**
  * Free a tree builder
diff --git a/src/tree.c b/src/tree.c
index 5a48bfc..3799cab 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -340,7 +340,7 @@ size_t git_tree_entrycount(const git_tree *tree)
 	return tree->entries.size;
 }
 
-unsigned int git_treebuilder_entrycount(git_treebuilder *bld)
+size_t git_treebuilder_entrycount(git_treebuilder *bld)
 {
 	assert(bld);