mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
tree functions: return an int
Stop returning a void for functions, future-proofing them to allow them to fail.
This commit is contained in:
@@ -258,8 +258,9 @@ GIT_EXTERN(int) git_treebuilder_new(
|
||||
* Clear all the entires in the builder
|
||||
*
|
||||
* @param bld Builder to clear
|
||||
* @return 0 on success; error code otherwise
|
||||
*/
|
||||
GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
|
||||
GIT_EXTERN(int) git_treebuilder_clear(git_treebuilder *bld);
|
||||
|
||||
/**
|
||||
* Get the number of entries listed in a treebuilder
|
||||
@@ -357,8 +358,9 @@ typedef int GIT_CALLBACK(git_treebuilder_filter_cb)(
|
||||
* @param bld Tree builder
|
||||
* @param filter Callback to filter entries
|
||||
* @param payload Extra data to pass to filter callback
|
||||
* @return 0 on success, non-zero callback return value, or error code
|
||||
*/
|
||||
GIT_EXTERN(void) git_treebuilder_filter(
|
||||
GIT_EXTERN(int) git_treebuilder_filter(
|
||||
git_treebuilder *bld,
|
||||
git_treebuilder_filter_cb filter,
|
||||
void *payload);
|
||||
|
||||
@@ -834,7 +834,7 @@ out:
|
||||
return error;
|
||||
}
|
||||
|
||||
void git_treebuilder_filter(
|
||||
int git_treebuilder_filter(
|
||||
git_treebuilder *bld,
|
||||
git_treebuilder_filter_cb filter,
|
||||
void *payload)
|
||||
@@ -850,9 +850,11 @@ void git_treebuilder_filter(
|
||||
git_tree_entry_free(entry);
|
||||
}
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void git_treebuilder_clear(git_treebuilder *bld)
|
||||
int git_treebuilder_clear(git_treebuilder *bld)
|
||||
{
|
||||
git_tree_entry *e;
|
||||
|
||||
@@ -860,6 +862,8 @@ void git_treebuilder_clear(git_treebuilder *bld)
|
||||
|
||||
git_strmap_foreach_value(bld->map, e, git_tree_entry_free(e));
|
||||
git_strmap_clear(bld->map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void git_treebuilder_free(git_treebuilder *bld)
|
||||
|
||||
Reference in New Issue
Block a user